Method for generating two-dimensional barcode, device for generating two-dimensional barcode, method for reading two-dimensional barcode, device for reading two-dimensional barcode, two-dimensional barcode, and program

ABSTRACT

A method for generating two-dimensional barcode, including: obtaining a data block including a first data codeword and an error correction codeword, the first data codeword having first information, the error correction codeword being capable of detecting and correcting an error of the first data codeword; and obtaining a replaced data block in which a part of the data block is replaced with a second data codeword, the second data codeword having second information; and generating a two-dimensional barcode based on the replaced data block. A method for reading a two-dimensional barcode including: reading a two-dimensional barcode; extracting a second data codeword from a predetermined position in a replaced data block; obtaining the second information from the extracted second data codeword; obtaining the first data codeword based on the replaced data block; and obtaining the first information from the obtained first data codeword.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a 371 U.S. National Stage of InternationalApplication No. PCT/JP2014/077084, filed Oct. 9, 2014, which claims thebenefit of and priority to Japanese Patent Application Nos. 2013-225332and 2013-225336, both filed on Oct. 30, 2013. The entire disclosures ofthe above applications are incorporated herein by reference.

TECHNICAL FIELD

The invention relates to a technique by which secret information isconcealed in a two-dimensional barcode, the two-dimensional barcodeindicating information using graphics.

BACKGROUND ART

As a technique of a two-dimensional barcode, by which a graphic code isread and information contained in the code is retrieved, there isJapanese Industrial Standards (JIS)X 0510:2004 “Two dimensionalsymbol—QR Code—”, for example. In addition, a technique for concealingsecret information (which is not information to be displayed) into sucha two-dimensional barcode is developed. A technique of concealing secretinformation into such a two-dimensional barcode which has a standardappearance helps to develop application for industries which is demandedhandling cryptographic key information or personal information.

[Patent Literature 1] discloses a technique that, in an encrypted matrixtwo-dimensional barcode composed of black and white pattern, a key fordecoding is indicated by deformed cells which have a shape or densitydifferent from standard ones.

[Patent Literature 2] discloses a technique that the decryption key codepattern of an encrypted two-dimensional barcode overlaps in aconfiguration in which the key code pattern is overwritten on a regionof at least either one of a data codeword region and a correctioncodeword region on the generated two-dimensional barcode pattern.

[Patent Literature 3] discloses a technique for generating a codegraphics as follow. If the total number of data codewords, which arecoded as codewords indicating data is smaller than the predeterminedtotal number of codewords for generating a two-dimensional barcode, aterminator is placed next to the foregoing codeword region. In addition,secret data codes are placed instead of a part of padding codes whichshould be placed next to the terminator.

CITATION LIST Patent Literature

[Patent Literature 1] Japanese Unexamined Patent Application PublicationNo. 2006-4378

[Patent Literature 2] Japanese Unexamined Patent Application PublicationNo. 2009-93443

[Patent Literature 3] Japanese Unexamined Patent Application PublicationNo. 2009-9547

[Non Patent Literature 1] Japanese Industrial Standards X 0510:2004

SUMMARY OF INVENTION Technical Problem

With techniques of [Patent Literature 1] and [Patent Literature 2],“deformed cells” or “black and white pattern” indicating decryption keyinformation, which is information to be concealed, are generated on acode pattern graphics, the “deformed cells” or “black and white pattern”being different from those of original codes. And, replacing (in otherwords, overwriting) operation is performed at a predetermined region orpositions on the graphics.

In the foregoing techniques, key information, which is used for decodinga two-dimensional barcode, is not encrypted. Accordingly, in a codegeneration system in which an identical cryptographic key is applied, anidentical “pattern” is exhibited at the same place. There is therefore apossibility that careful observation of a graphic code pattern raisesdoubts about concealing an information pattern. The same applies to acase of the foregoing “deformed cells”.

Even if the foregoing key “pattern” is placed at a plurality of placeson a code graphics, replacement positions are predetermined on thegraphic pattern because the key pattern is overwritten on the graphicpattern. Accordingly, “fixed parts” can be found by overlapping aplurality of samples of a two-dimensional barcode to which identical keyinformation is applied.

In the foregoing technique, an encoding process requires a specialprocess for generating a pattern graphics which is to be used foroverwriting. Such a process is complicated and prevents acceleratingoperations.

[Patent Literature 3] discloses a technique for generating a codegraphics as follow. If the total number of data codewords, which arecoded as codewords indicating data is smaller than the predeterminedtotal number of codewords for generating a two-dimensional barcode, aterminator is placed next to the foregoing codeword region. In addition,secret data codes are placed instead of a part of padding codes whichshould be placed next to the terminator.

With such a technique, different data codes from a code pattern whichshould be defined as padding codes are placed in a region of paddingcodes. Accordingly, the foregoing codes are recognized as nonstandardcodes by a standard general-purpose decoder, the decoder being inconformance with a code format which is based on a standard defining acode pattern of padding codes as in [Non Patent Literature 1]. In thiscase, since nonstandard data codes also exist in a data region which isnot to be displayed, there is possibility that the behavior of such astandard general-purpose decoder cannot be expected.

If the amount of concealed information is equal to or is larger than theamount of information to be displayed, in some cases, a two-dimensionalbarcode has an unreasonably larger size than the size of a barcodehaving the amount of to-be-displayed information which should beobtained in a standard decoding process. This will make a user todistrust the two-dimensional barcode and will raise doubts aboutconcealing information.

For these reasons, a new two-dimensional barcode has been demanded whichis capable of concealing information being concealed in addition toinformation being revealed. Also, there is a demand for appropriatelyreading the information being concealed of this new two-dimensionalbarcode.

An aspect of the present invention is to provide a two-dimensionalbarcode capable of concealing information being concealed in addition toinformation being revealed. Another aspect of the present invention isto appropriately read the information being concealed from this newtwo-dimensional barcode.

Solution to Problem

In order to achieve the above advantage, a method for generating atwo-dimensional barcode according to the present invention includes:obtaining a data block including a first data codeword and an errorcorrection codeword, the first data codeword having first information,the error correction codeword being capable of detecting and correctingan error of the first data codeword; obtaining a replaced data block inwhich a part of the data block is replaced with a second data codeword,the second data codeword having second information; and generating atwo-dimensional barcode based on the replaced data block.

With a two-dimensional barcode generated as mentioned above, though apart of the first data codeword and a part of the error correctioncodeword are replaced with the second data codeword, the first datacodeword can be corrected and recovered using the correction codeword.The second data codeword can be extracted from a replaced data block,the replaced data block having not undergone error correction and beingobtained by directly reading the two-dimensional barcode. Based on theextracted second data codeword, the second information can be acquired.If, in this case, the second information contains information beingconcealed, it is possible to provide a two-dimensional barcode capableof concealing the information in addition to information being revealed.

In such a method for generating a two-dimensional barcode according tothe present invention, it is desirable that the replaced data blockincludes a header data codeword, and that the header data codewordcontains placement information of the second data codeword in thereplaced data block.

With a two-dimensional barcode generated as mentioned above, it ispossible to appropriately locate the position of the second datacodeword based on the header data codeword.

In such a method for generating a two-dimensional barcode according tothe present invention, it is desirable that the total number of thesecond data codewords and the header data codewords is not greater thanthe number of words that are able to be corrected with the errorcorrection codeword.

With a two-dimensional barcode generated as mentioned above, the seconddata codeword and the header data codeword can be appropriatelycorrected based on the error correction codeword. This makes it possibleto reliably obtain the first data codeword.

In such a method for generating a two-dimensional barcode according tothe present invention, it is desirable that the second data codewordsare discontinuously placed based on placement information of the seconddata codeword.

With a two-dimensional barcode generated as mentioned above,discontinuously placing the second data codeword can increase concealability of the second data codeword. In addition, the placementinformation makes it possible to appropriately identify the positions ofthe second data codeword.

In such a method for generating a two-dimensional barcode according tothe present invention, it is desirable that at least either one of theheader data codeword and the second data codeword contains anerror-correction-code word.

With a two-dimensional barcode generated as mentioned above, if theheader data codeword contains the error-correction-code word, it ispossible to appropriately correct the header data codeword even when theheader data codeword has an error. Also, if the second data codewordcontains the error-correction-code word, it is possible to appropriatelycorrect the second data codeword even when the second data codeword hasan error.

In such a method for generating a two-dimensional barcode according tothe present invention, it is acceptable that, in the replaced datablock, a part of the second data codeword is replaced with the headerdata codeword, and that the second data codeword contains an errorcorrection codeword that is capable of detecting and correcting an errorof the second data codeword.

With a two-dimensional barcode generated as mentioned above, theposition of the second data codeword can be identified based on theheader data codeword, and a part of the second data codeword can becorrected by the error correction code, the part of the second datacodeword being replaced with the header data codeword. This makes itpossible to appropriately obtain the second information from the seconddata codeword.

In such a method for generating a two-dimensional barcode according tothe present invention, a part of the first data codeword may contain theheader data codeword, and the header data codeword may contain placementinformation of the second data codeword in the replaced data block.

With a two-dimensional barcode generated as mentioned above, the firstdata codeword can be obtained based on the error correction codewordwhich is included in the replaced data block. Based on the header datacodeword which is contained in the first data codeword, it is possibleto identify the position of the second data codeword in the replaceddata block. This makes it possible to appropriately extract the seconddata codeword, and also makes it possible to extract the secondinformation from the second data codeword. Accordingly, conceal abilitycan further increase.

In such a method for generating a two-dimensional barcode according tothe present invention, a part of the first data codeword may contain aheader-position-data codeword, and the header-position-data codeword maycontain placement information of the header data codeword in thereplaced data block.

With a two-dimensional barcode generated as mentioned above, the firstdata codeword can be obtained based on the error correction codewordwhich is contained in the replaced data block. And, based on theheader-position-data codeword which is contained in the first datacodeword, it is possible to identify the position of the header datacodeword in the replaced data block. Further, the header data codewordcan be extracted from the identified position of the header datacodeword, and the position of the second data codeword can be identifiedbased on the header data codeword. Finally, the second information canbe extracted based on the second data codeword. Accordingly, concealability can further increase.

Further, it is acceptable that the two-dimensional barcode is maskedwith a predetermined mask pattern. And, it is acceptable that obtainingthe replaced data block includes: identifying a replacement position inthe data block based on a mask pattern reference, the mask patternreference identifying the predetermined mask pattern; and replacing apart of the data block with the second data codeword at the replacementposition.

With such a method, the mask pattern reference, which identifies themask pattern applied to the two-dimensional barcode, is used to identifythe position of the data block the word at which is replaced with thesecond data codeword. Since there are multiple types of the maskpatterns, the mask pattern reference can have a plurality of values.Accordingly, depending on the applied mask pattern, it is possible tochange a position which has been replaced with the second data codeword.This makes it difficult for a third party to identify the position ofthe second data codeword, and therefore it can be further difficult toextract the second information contained in the second data codeword.

It is acceptable that the two-dimensional barcode is masked with apredetermined mask pattern. And, it is acceptable that obtaining thereplaced data block includes: locating a replacement position in thedata block based on a mask pattern reference, the mask pattern referenceidentifying the predetermined mask pattern; replacing a part of the datablock with the header data codeword at the replacement position; andreplacing a part of the data block with the second data codeword at aposition that is specified by the header data codeword.

With such a method, the mask pattern reference, which identifies themask pattern applied to the two-dimensional barcode, is used to locatethe position of the data block which is replaced with the header datacodeword. Since there are multiple types of the mask patterns, the maskpattern reference can have a plurality of values. Accordingly, dependingon the applied mask pattern, it is possible to change the position ofthe data block which is replaced with the header data codeword. Thismakes it difficult for a third party to locate the position of theheader data codeword. Since the header data codeword locates theposition of the second data codeword, it can be further difficult toextract the second data codeword.

It is desirable that the two-dimensional barcode is a QR code, and thatthe mask pattern reference is contained in format information of the QRcode.

The format information of the QR code is not masked by the standard maskpattern (a predetermined mask pattern), according to JIS. Accordingly,when a QR code is read, it is possible to appropriately read the maskpattern reference, which is contained in the format information. Using apredetermined mask pattern identified by the mask pattern reference,masking can be removed. In the replaced data codewords which is obtainedafter the masking is removed, using the mask pattern reference makes itpossible to appropriately locate the position of the second datacodeword or the position of the header data codeword.

In such a method for generating a two-dimensional barcode according tothe present invention, obtaining the replaced data block may include:identifying a replacement position in the data block based on the errorcorrection codeword; and replacing a part of the data block with thesecond data codeword at the replacement position.

The error correction codeword is obtained based on the first datacodeword. Accordingly, a different first data codeword leads to adifferent error correction codeword. That is, when the replacementposition is identified based on the error correction codeword, areplacement position is different if a first data codeword is different.This makes it difficult for a third party to identify the position ofthe second data codeword, and therefore it can be further difficult toextract the second information contained in the second data codeword.

In such a method for generating a two-dimensional barcode according tothe present invention, obtaining the replaced data block may include:identifying a replacement position in the data block based on the errorcorrection codeword; replacing a part of the data block with the headerdata codeword at the identified replacement position; and replacing apart of the data block with the second data codeword at a position thatis specified by the header data codeword.

The error correction codeword is obtained based on the first datacodeword. Accordingly, a different first data codeword leads to adifferent error correction codeword. That is, when the replacementposition is identified based on the error correction codeword, areplacement position is different if a first data codeword is different.This makes it difficult for a third party to identify the position ofthe header data codeword. Since the header data codeword identifies theposition of the second data codeword, it can be further difficult toextract the second data codeword.

In such a method for generating a two-dimensional barcode according tothe present invention, it is desirable that the error correctioncodeword is a Reed-Solomon code.

With such a two-dimensional barcode generated as mentioned above, sincea Reed-Solomon code, which has a great correcting capability as theerror correction codeword, is used, it is possible to appropriatelyobtain the first data codeword.

In such a method for generating a two-dimensional barcode according tothe present invention, it is desirable that the method further comprisesoutputting the generated two-dimensional barcode.

With such a method for generating a two-dimensional barcode, thegenerated two-dimensional barcode can be output by means such asprinting and can be read by a suitable decoder.

In order to achieve the above advantage, a two-dimensional barcodeaccording to the present invention is generated based on a replaced datablock, the replaced data block in which a part of a data block isreplaced with a second data codeword, the data block including a firstdata codeword and an error correction codeword, the first data codewordhaving first information, the error correction codeword being capable ofdetecting and correcting an error of the first data codeword, the seconddata codeword having second information.

With a two-dimensional barcode generated as mentioned above, though apart of the first data codeword and a part of the error correctioncodeword are replaced with the second data codeword, the first datacodeword can be corrected and recovered using the correction codeword.The second data codeword can be extracted from a replaced data block,the replaced data block having not undergone error correction and beingobtained by directly reading the two-dimensional barcode. Based on theextracted second data codeword, the second information can be acquired.If, in this case, the second information contains information beingconcealed, it is possible to provide a two-dimensional barcode capableof concealing the information in addition to information being revealed.

In order to achieve the above advantage, a device for generating atwo-dimensional barcode according to the present invention generates atwo-dimensional barcode based on a replaced data block, the replaceddata block in which a part of a data block is replaced with a seconddata codeword, the data block including a first data codeword and anerror correction codeword, the first data codeword having firstinformation, the error correction codeword being capable of detectingand correcting an error of the first data codeword, the second datacodeword having second information.

With a two-dimensional barcode generated as mentioned above, though apart of the first data codeword and a part of the error correctioncodeword are replaced with second data codeword, the first data codewordcan be corrected and recovered using the correction codeword. The seconddata codeword can be extracted from a replaced data block, the replaceddata block having not undergone error correction and being obtained bydirectly reading the two-dimensional barcode. Based on the extractedsecond data codeword, the second information can be acquired. If, inthis case, the second information contains information being concealed,it is possible to provide a two-dimensional barcode capable ofconcealing the information in addition to information being revealed.

In order to achieve the above advantage, a program according to thepresent invention causes a computer to perform the following processes:obtaining a data block including a first data codeword and an errorcorrection codeword, the first data codeword having first information,the error correction codeword being capable of detecting and correctingan error of the first data codeword; obtaining a replaced data block inwhich a part of the data block is replaced with a second data codeword,the second data codeword having second information; and generating atwo-dimensional barcode based on the replaced data block.

With a two-dimensional barcode generated as mentioned above, though apart of the first data codeword and a part of the error correctioncodeword are replaced with the second data codeword, the first datacodeword can be corrected and recovered using the correction codeword.The second data codeword can be extracted from a replaced data block,the replaced data block having not undergone error correction and beingobtained by directly reading the two-dimensional barcode. Based on theextracted second data codeword, the second information can be acquired.If, in this case, the second information contains information beingconcealed, it is possible to provide a two-dimensional barcode capableof concealing the information in addition to information being revealed.

In order to achieve the above advantage, it is desirable that a methodfor reading a two-dimensional barcode according to the present inventionincludes: reading a two-dimensional barcode, the two-dimensional barcodebeing generated based on a replaced data block, the replaced data blockbeing obtained by replacing a part of a data block with a second datacodeword, the data block including a first data codeword and an errorcorrection codeword, the first data codeword having first information,the second data codeword having second information, the error correctioncodeword being capable of detecting and correcting an error of the firstdata codeword; extracting the second data codeword from a predeterminedposition in the replaced data block; obtaining the second informationfrom the extracted second data codeword; obtaining the first datacodeword based on the replaced data block; and obtaining the firstinformation from the obtained first data codeword.

With such a method for reading a two-dimensional barcode, though a partof the first data codeword and a part of the error correction codewordare replaced with the second data codeword, the first data codeword canbe corrected and recovered using the correction codeword. The seconddata codeword can be extracted from a replaced data block, the replaceddata block having not undergone error correction and being obtained bydirectly reading the two-dimensional barcode. Based on the extractedsecond data codeword, the second information can be acquired. If, inthis case, the second information contains information being concealed,it is possible to appropriately read the information being concealed.

In such a method for reading a two-dimensional barcode according to thepresent invention, it is desirable that the replaced data block includesa header data codeword, and that the predetermined position isidentified based on the header data codeword.

With such a method for reading a two-dimensional barcode, it is possibleto appropriately locate the position of the second data codeword basedon the header data codeword.

In such a method for reading a two-dimensional barcode according to thepresent invention, it is desirable that the total number of the seconddata codewords and the header data codewords is not greater than thenumber of words that are able to be corrected with the error correctioncodeword.

With such a method for reading a two-dimensional barcode, the seconddata codeword and the header data codeword can be appropriatelycorrected based on the error correction codeword. This makes it possibleto reliably obtain the first data codeword.

In such a method for reading a two-dimensional barcode according to thepresent invention, it is desirable that the header data codewordcontains placement information of the second data codewords, and thatthe second data codewords are discontinuously placed based on theplacement information.

With such a method for reading a two-dimensional barcode,discontinuously placing the second data codewords can increase concealability of the second data codewords. In addition, the placementinformation makes it possible to appropriately identify the positions ofthe second data codeword.

In such a method for reading a two-dimensional barcode according to thepresent invention, it is desirable that at least either one of theheader data codeword and the second data codeword contains anerror-correction-code word.

With such a method for reading a two-dimensional barcode, if the headerdata codeword contains the error-correction-code word, it is possible toappropriately correct the header data codeword even when the header datacodeword has an error. Also, if the second data codeword contains theerror-correction-code word, it is possible to appropriately correct thesecond data codeword even when the second data codeword has an error.

In such a method for reading a two-dimensional barcode according to thepresent invention, in the replaced data block, a part of the second datacodeword is replaced with the header data codeword, the second datacodeword contains an error correction codeword that is capable ofdetecting and correcting the second data codeword, and obtaining thesecond information includes: identifying the predetermined positionbased on the header data codeword, obtaining the second data codewordfrom the identified predetermined position, a part of the second datacodeword being replaced with the header data codeword; correcting thesecond data codeword based on the error correction codeword contained inthe second data codeword; and obtaining the second information from thecorrected second data codeword.

With such a method for reading a two-dimensional barcode, the positionof the second data codeword can be identified based on the header datacodeword, and a part of the second data codeword can be corrected by theerror correction code, the part of the second data codeword beingreplaced with the header data codeword. This makes it possible toappropriately obtain the second information from the second datacodeword.

In such a method for reading a two-dimensional barcode according to thepresent invention, a part of the first data codeword contains the headerdata codeword, and obtaining the second information includes: obtainingthe header data codeword by correcting an error of the replaced datablock; obtaining the second data codeword by identifying a position ofthe second data codeword based on the obtained header data codeword, theposition of the second data codeword being in the replaced data block;and obtaining the second information from the obtained second datacodeword.

With such a method for reading a two-dimensional barcode, the first datacodeword can be obtained based on the error correction codewordcontained in the replaced data block. And, based on the header datacodeword contained in the first data codeword, it is possible toidentify the position of the second data codeword in the replaced datablock. This makes it possible to appropriately extract the second datacodeword, and also makes it possible to extract the second informationfrom the second data codeword. Accordingly, conceal ability can furtherincrease.

In such a method for reading a two-dimensional barcode according to thepresent invention, a part of the first data codeword may contain aheader-position-data codeword, the header-position-data codewordidentifying a position of the header data codeword. Also, obtaining thesecond information may include: obtaining the header-position-datacodeword by correcting an error of the replaced data block, theheader-position-data codeword being contained the first data codeword;obtaining the header data codeword by identifying the position of theheader data codeword based on the extracted header-position-datacodeword; obtaining the second data codeword by identifying a positionof the second data codeword based on the obtained header data codeword,the position of the second data codeword being in the replaced datablock; and obtaining the second information from the obtained seconddata codeword.

With such a method for reading a two-dimensional barcode, the first datacodeword can be obtained based on the error correction codeword which iscontained in the replaced data block. And, based on theheader-position-data codeword which is contained in the first datacodeword, it is possible to identify the position of the header datacodeword in the replaced data block. Further, the header data codewordcan be extracted from the identified position of the header datacodeword, and the position of the second data codeword can be identifiedbased on the header data codeword. Finally, the second information canbe extracted based on the second data codeword. Accordingly, concealability can further increase.

In such a method for reading a two-dimensional barcode according to thepresent invention, the two-dimensional barcode may be masked with apredetermined mask pattern. Further, reading the two-dimensional barcodemay include reading a mask pattern reference, the mask pattern referenceidentifying the predetermined mask pattern that is applied to thetwo-dimensional barcode. Also, extracting the second data codeword fromthe predetermined position in the replaced data block may include:identifying a replacement position in the replaced data block based onthe mask pattern reference; and extracting the second data codeword fromthe identified replacement position in the replaced data block.

With such a method, the mask pattern reference, which identifies themask pattern applied to the two-dimensional barcode, is used to identifythe position the word at which is replaced with the second datacodeword. Since there are multiple types of the mask patterns, the maskpattern reference can have a plurality of values. Accordingly, dependingon the applied mask pattern, it is possible to change a position whichhas been replaced with the second data codeword. This makes it difficultfor a third party to identify the position of the second data codeword,and therefore it can be further difficult to extract the secondinformation contained in the second data codeword.

In such a method for reading a two-dimensional barcode according to thepresent invention, the two-dimensional barcode may be masked with apredetermined mask pattern. Further, reading the two-dimensional barcodemay include reading a mask pattern reference, the mask pattern referenceidentifying the predetermined mask pattern that is applied to thetwo-dimensional barcode. And, extracting the second data codeword from apredetermined position in the replaced data block may include:identifying a replacement position in the replaced data block based onthe mask pattern reference; extracting the header data codeword from theidentified replacement position in the replaced data block; andextracting the second data codeword from a position that is identifiedby the extracted header data codeword of the replaced data block.

With such a method, the mask pattern reference, which identifies themask pattern applied to the two-dimensional barcode, is used to locatethe position of the data block which is replaced with the header datacodeword. Since there are multiple types of the mask patterns, the maskpattern reference can have a plurality of values. Accordingly, dependingon the applied mask pattern, it is possible to change the position ofthe data block which is replaced with the header data codeword. Thismakes it difficult for a third party to locate the position of theheader data codeword. Since the header data codeword locates theposition of the second data codeword, it can be further difficult toextract the second data codeword.

In such a method for reading a two-dimensional barcode according to thepresent invention, it is desirable that the two-dimensional barcode is aQR code, and that the mask pattern reference is contained in formatinformation of the QR code.

The format information of the QR code is not masked by the standard maskpattern (a predetermined mask pattern), according to JIS. Accordingly,when a QR code is read, it is possible to appropriately read the maskpattern reference, which is contained in the format information. Using apredetermined mask pattern identified by the mask pattern reference,masking can be removed. In the replaced data codewords which is obtainedafter the masking is removed, using the mask pattern reference makes itpossible to appropriately locate the position of the second datacodeword or the position of the header data codeword.

In such a method for reading a two-dimensional barcode according to thepresent invention, extracting the second data codeword from thepredetermined position in the replaced data block may include:identifying a replacement position in the replaced data block based onthe error correction codeword, and extracting the second data codewordfrom the replacement position in the replaced data block.

The error correction codeword is obtained based on the first datacodeword. Accordingly, a different first data codeword leads to adifferent error correction codeword. That is, when the replacementposition is identified based on the error correction codeword, areplacement position is different if a first data codeword is different.This makes it difficult for a third party to identify the position ofthe second data codeword, and therefore it can be further difficult toextract the second information contained in the second data codeword.

In such a method for reading a two-dimensional barcode according to thepresent invention, extracting the second data codeword from apredetermined position in the replaced data block may include:identifying a replacement position in the replaced data block based onthe error correction codeword; extracting the header data codeword fromthe identified replacement position in the replaced data block; andextracting the second data codeword from a position that is specified bythe header data codeword in the replaced data block.

The error correction codeword is obtained based on the first datacodeword. Accordingly, a different first data codeword leads to adifferent error correction codeword. That is, when the replacementposition is identified based on the error correction codeword, areplacement position is different if a first data codeword is different.This makes it difficult for a third party to identify the position ofthe header data codeword. Since the header data codeword identifies theposition of the second data codeword, it can be further difficult toextract the second data codeword.

In such a method for reading a two-dimensional barcode according to thepresent invention, it is desirable that obtaining the first datacodeword based on the replaced data block includes correcting an errorof the replaced data block using an error correction codeword, the errorcorrection codeword being included in the replaced data block.

With such a method for reading a two-dimensional barcode, since theerror correction codeword is used, it is possible to appropriatelyobtain the first data codeword.

In such a method for reading a two-dimensional barcode according to thepresent invention, it is desirable that the error correction codeword isa Reed-Solomon code.

With such a method for reading a two-dimensional barcode, since aReed-Solomon code, which has a great correcting capability as the errorcorrection codeword, is used, it is possible to appropriately obtain thefirst data codeword.

In such a method for reading a two-dimensional barcode according to thepresent invention, it is desirable that the method further comprisesoutputting at least either one of the first information and the secondinformation.

With such a method for reading a two-dimensional barcode, it is possibleto obtain the decoded first information or the decoded secondinformation.

In order to achieve the above advantage, it is desirable that method forreading a two-dimensional barcode according to the present inventionincludes: reading a two-dimensional barcode, the two-dimensional barcodebeing generated based on a replaced data block, the replaced data blockbeing obtained by replacing a part of a data block with a second datacodeword, the data block including a first data codeword and an errorcorrection codeword, the first data codeword having first information,the second data codeword having second information, the error correctioncodeword being capable of detecting and correcting an error of the firstdata codeword; obtaining the data block based on the replaced datablock; obtaining the second data codeword based on the data block andthe replaced data block; and obtaining the second information from theobtained second data codeword.

With such a method for reading a two-dimensional barcode, though a partof the first data codeword and a part of the error correction codewordare replaced with the second data codeword, the first data codeword canbe corrected and recovered using the correction codeword. On the otherhand, the second data codeword can be obtained by making a comparisonand by obtaining the difference between data before correction of thereplaced data block and data after the correction. Based on the obtainedsecond data codeword, the second information can be acquired. If, inthis case, the second information contains information being concealed,it is possible to appropriately read the information being concealed.

In such a method for reading a two-dimensional barcode according to thepresent invention, it is desirable that obtaining the second datacodeword based on the data block and the replaced data block includesextracting a part from the replaced data block, the part not beingidentical between the data block and the replaced data block.

With such a method for reading a two-dimensional barcode, a comparisonis made between the data block and the replaced data block and thedifferent part can consequently be specified as the second datacodeword.

In such a method for reading a two-dimensional barcode according to thepresent invention, it is desirable that obtaining the data block basedon the replaced data block includes correcting an error of the replaceddata block using the error correction codeword, the error correctioncodeword being included in the replaced data block.

With such a method for reading a two-dimensional barcode, an error ofthe replaced data block can be corrected using the error correctioncodeword, and the unreplaced data block can be consequently recovered.

In such a method for reading a two-dimensional barcode according to thepresent invention, it is desirable that the method further includesobtaining the first information from the first data codeword based onthe obtained data block and the replaced data block.

With such a method for reading a two-dimensional barcode, if the firstinformation is information being revealed, it is possible toappropriately acquire the information being revealed and informationbeing concealed.

In order to achieve the above advantage, it is desirable that a devicefor reading a two-dimensional barcode according to the present inventionincludes: a reading section that reads a two-dimensional barcode, thetwo-dimensional barcode being generated based on a replaced data block,the replaced data block being obtained by replacing a part of a datablock with a second data codeword, the data block including a first datacodeword and an error correction codeword, the first data codewordhaving first information, the second data codeword having secondinformation, the error correction codeword being capable of detectingand correcting an error of the first data codeword; and a controlsection that extracts the second data codeword from a predeterminedposition in the replaced data block, that obtains the second informationfrom the extracted second data codeword, that obtains the first datacodeword based on the replaced data block, and that obtains the firstinformation from the obtained first data codeword.

With such a device for reading a two-dimensional barcode, though a partof the first data codeword and a part of the error correction codewordare replaced with the second data codeword, the first data codeword canbe corrected and recovered using the correction codeword. The seconddata codeword can be extracted from a replaced data block, the replaceddata block having not undergone error correction and being obtained bydirectly reading the two-dimensional barcode. Based on the extractedsecond data codeword, the second information can be acquired. In thiscase, the second information can contain information being concealed.This makes it possible to appropriately read the information beingconcealed.

In order to achieve the above advantage, it is desirable that a programaccording to the present invention causes a computer to perform thefollowing processes: reading a two-dimensional barcode, thetwo-dimensional barcode being generated based on a replaced data block,the replaced data block being obtained by replacing a part of a datablock with a second data codeword, the data block including a first datacodeword and an error correction codeword, the first data codewordhaving first information, the second data codeword having secondinformation, the error correction codeword being capable of detectingand correcting an error of the first data codeword; extracting thesecond data codeword from a predetermined position in the replaced datablock; obtaining the second information from the extracted second datacodeword; obtaining the first data codeword based on the replaced datablock; and obtaining the first information from the obtained first datacodeword.

With such a program, though a part of the first data codeword and a partof the error correction codeword are replaced with the second datacodeword, the first data codeword can be corrected and recovered usingthe correction codeword. The second data codeword can be extracted froma replaced data block, the replaced data block having not undergoneerror correction and being obtained by directly reading thetwo-dimensional barcode. Based on the extracted second data codeword,the second information can be acquired. In this case, the secondinformation can contains information being concealed. This makes itpossible to appropriately read the information being concealed.

Advantageous Effects of Invention

With a two-dimensional barcode configured in the foregoing manner,though a part of the first data codeword and a part of the errorcorrection codeword are replaced with the second data codeword, thefirst data codeword can be corrected and recovered using the correctioncodeword. The second data codeword can be extracted from a replaced datablock, the replaced data block having not undergone error correction andbeing obtained by directly reading the two-dimensional barcode. Based onthe extracted second data codeword, the second information can beacquired. If, in this case, the second information contains informationbeing concealed, it is possible to provide a two-dimensional barcodecapable of concealing the information being concealed in addition toinformation being revealed.

With the foregoing method for reading a two-dimensional barcode, thougha part of the first data codeword and a part of the error correctioncodeword are replaced with the second data codeword, the first datacodeword can be corrected and recovered using the correction codeword.The second data codeword can be extracted from a replaced data block,the replaced data block having not undergone error correction and beingobtained by directly reading the two-dimensional barcode. Based on theextracted second data codeword, the second information can be acquired.In this case, the second information can contains information beingconcealed. This makes it possible to appropriately read the informationbeing concealed.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a diagram illustrating a QR code symbol 1.

FIG. 2 is a block diagram of an enhanced encoder 10 according to thefirst embodiment.

FIG. 3 is a schematic diagram of a RS block according to the firstembodiment.

FIG. 4 is a flow chart of a method for generating a QR code symbolaccording to the first embodiment.

FIG. 5 is a diagram illustrating a RS block.

FIG. 6 is a diagram illustrating concealed-information words.

FIG. 7 is a first diagram illustrating how to replace a part of a RSblock in a procedure according to the first embodiment.

FIG. 8 is a block diagram of an enhanced decoder 20.

FIG. 9 is a flow chart of a method for reading a QR code symbolaccording to the first embodiment.

FIG. 10 is a diagram illustrating a method for extractingconceal-information words.

FIG. 11 is a diagram illustrating a method for extracting original data.

FIG. 12 is a second diagram illustrating how to replace a part of a RSblock in a procedure according to the first embodiment.

FIG. 13 is a third diagram illustrating how to replace a part of a RSblock in a procedure according to the first embodiment.

FIG. 14 is a conceptual diagram of a RS block according to the secondembodiment.

FIG. 15 is a diagram illustrating a header and conceal-information wordsaccording to the second embodiment.

FIG. 16 is a first diagram illustrating how to replace a part of a RSblock in a procedure according to the second embodiment.

FIG. 17 is a second diagram illustrating how to replace a part of a RSblock in a procedure according to the second embodiment.

FIG. 18 is a third diagram illustrating how to replace a part of a RSblock in a procedure according to the second embodiment.

FIG. 19 is a diagram illustrating how to replace a part of a RS block ina procedure according to the third embodiment.

FIG. 20 is a diagram illustrating how to replace a part of a RS block ina procedure according to the fourth embodiment.

FIG. 21 is a diagram illustrating how to replace a part of a RS block ina procedure according to the fifth embodiment.

FIG. 22 is a first diagram illustrating how to replace a part of a RSblock in a procedure according to the sixth embodiment.

FIG. 23 is a second diagram illustrating how to replace a part of a RSblock in a procedure according to the sixth embodiment.

FIG. 24 is a third diagram illustrating how to replace a part of a RSblock in a procedure according to the sixth embodiment.

FIG. 25 is a diagram illustrating RS blocks having a data loss.

FIG. 26 is a diagram illustrating how to restore an initial-end-loss RSblock.

FIG. 27 is a diagram illustrating how to restore a final-end-loss RSblock.

FIG. 28 is a diagram illustrating how to restore a two-end-loss RSblock.

FIG. 29 is a flow chart of a method for generating a QR code symbolaccording to the seventh embodiment.

FIG. 30 is a diagram illustrating how to replace a part of a RS block ina procedure according to the seventh embodiment.

FIG. 31 is a flow chart of a method for reading a QR code symbolaccording to the seventh embodiment.

FIG. 32 is a diagram illustrating how to replace a part of a RS block ina procedure according to the eighth embodiment.

FIG. 33 is a first diagram illustrating how to replace a part of a RSblock in a procedure according to the ninth embodiment.

FIG. 34 is a second diagram illustrating how to replace a part of a RSblock in a procedure according to the ninth embodiment.

DESCRIPTION OF EMBODIMENTS

===First Embodiment===

A two-dimensional barcode according to the first embodiment will bedescribed below. As an example of a two-dimensional barcode, a QR codewill described below. However, a two-dimensional barcode may be aDatamatrix, a MaxiCode, a VeriCode, a Karura code, a CP code, or thelike.

Unless otherwise stated, the following description is in conformancewith Japanese Industrial Standards X 0510:2004 “Two dimensionalsymbol—QR Code—” (hereinafter merely referred to as “JIS”). An encoderin conformance with JIS is referred to as a standard encoder, and adecoder in conformance with JIS is referred to as a standard decoder. Anencoder which can handles conceal information according to the firstembodiment is referred to as an enhanced encoder, and such a decoder isreferred to as an enhanced decoder. These apparatuses will bedistinguished below.

In the following description, a “codeword” is eight bits long. But, thebit length of a “codeword” may be different such as 16 bits, one bit, orthe like, depending on a system.

FIG. 1 is a diagram illustrating a QR code symbol 1. The QR code symbol1 has various sizes which range from version 1 to version 40, butfunctions of version “2” QR code will be described in this example.

The QR code symbol 1 has a function pattern and an encoding region. Thefunction pattern is a pattern required to locate the position of the QRcode symbol and to identify the characteristics of the same; thelocating and the identifying are necessary to assist in decoding themodules of the QR code. The encoding region is a region in whichnecessary information is written.

The function pattern includes finder patterns FP, separators SP, timingpatterns TP, alignment patterns AP and a quiet zone QZ.

The finder patterns FP are respectively placed at least at three cornersof a QR code symbol. At the time of reading, identifying three finderpatterns FP allows the orientation and position of the QR code symbol 1to be exactly specified.

The separators SP are each light modules of one module width, and areeach located around each finder pattern FP. This makes it possible toseparate the finder patterns FP from the rest of the QR code symbol 1.

The module M is a unit cell constituting the QR code symbol 1. Inprinciple, one bit is equivalent to one module.

The timing patterns TP are each a pattern in which dark and lightmodules are placed in line alternately one by one. With the timingpatterns TP, it is possible to identify the number of the modules of theQR code symbol 1. Accordingly, the version of the QR code can beidentified.

The alignment patterns AP are patterns placed in the defined locationsaccording to the version of the QR code. In a case of large modules, thealignment patterns AP assist in locating the position of the QR codesymbol 1.

The quiet zone QZ is a light module zone of at least 4 modules width,and is located around the QR code.

The enclosing region includes data, error correction codewords, formatinformation FI, and version information. In this example, the data isactual data, and the error correction codewords are those for correctingan error which is caused by misreading of the data. The formatinformation FI contains information on the error correction levelapplied to the QR code symbol 1 and information on the mask pattern usedto the QR code symbol 1. The format information FI is a encode patternwhich is required to decode the encoding region. The version informationhas information of the version of the QR code.

FIG. 2 is a block diagram of an enhanced encoder 10 according to thefirst embodiment. The enhanced encoder 10 is an apparatus that converts,to the QR code symbol 1, information to be displayed and concealinformation. The enhanced encoder 10 includes a control section 11, adisplay device 13, a printing device 14 and an input device 15.

The control section 11 includes an operation section 11 a and a storagesection 11 b. The operation section 11 a is composed of units such as aCentral Processing Unit, and serves as executing programs and performingvarious operations. The storage section 11 b stores data necessary toexecute programs. In particular, the storage section 11 b stores aprogram for executing a method for generating a QR code (to be describedlater).

The display device 13 has a display function necessary at the time ofinputting data or the like. The display device 13 outputs by displayinga generated QR code symbol 1. And, the printing device 14 also outputsby printing a generated QR code symbol 1. The input device 15 is usedfor inputting data and is also used for operating the enhanced encoder10.

The configuration of the enhanced encoder 10 can be realized byinstalling a program to a common device like a computer, a mobile phoneor a smartphone, the program being for executing a method for generatinga QR code (to be described later).

FIG. 3 is a schematic diagram of RS block according to the firstembodiment. First, the data format of a QR code according to the firstembodiment will be briefly described with reference to FIG. 3. FIG. 3shows a Reed-Solomon (RS) block, which serves as a unit for errorcorrection. Each QR code symbol 1 contains one or multiple of RS blocks.A single RS block is a unit for error correction.

In the embodiment described herein, since error correction usingReed-Solomon (RS) code is employed, the “RS block” is described as anexample of a unit block for operation of detecting and correcting anerror.

A RS block contains data codewords (corresponding to the first datacodeword) composed of original data to be displayed, a terminator, andpadding codewords. The RS block also contains a Reed-Solomon (RS) code,which serves as correction codewords (corresponding to the correctioncodeword). The original data is a piece of information which can bedecoded by the standard decoder when the QR code symbol 1 is read. Theterminator is a code indicating the end of the original data. Thepadding codewords are provisional codewords used to fill empty positionsof codewords when the total number of the codewords of original datadoes not reach the capacity of the QR code symbol 1. The RS code is acode added for the purpose of error correction to a RS block, which is aunit of error correction.

Error correction level of the QR code can be selected from the followingfour levels: “level L”, “level M”, “level Q” and “level H”. In “levelL”, this type of error correction allows to correct up to 7% of wholecodewords. For example, the error correction capability allows torecover 7% of the whole codewords of a RS block. In “level M”, this typeof error correction allows to correct up to 15% of the whole codewords.In “level Q”, this type of error correction allows to correct up to 25%of the whole codewords. In “level H”, this type of error correctionallows to correct up to 30% of the whole codewords. In the firstembodiment, conceal information is concealed within a QR code, forexample, using “level H”, which has the highest error correctioncapability. It should be noted that error correction level may bechanged depending on the number of conceal-information words to beconcealed.

The concept of a procedure for concealing information within a QR codeaccording to the first embodiment is as follow. FIG. 3 showsconceal-information words (corresponding to the second data codeword).In the first embodiment, a part of a RS block is replaced withconceal-information words (hereinafter this “replace” is also referredto as “overwrite”). Even if a part of a RS block is replaced, thestandard decoder can correct, using a RS code, an original-data sectionwhich has been replaced. And, it is possible to extract and display thecorrected original-data section. On the other hand, since theconceal-information words are information which is corrected with the RScode and is discarded, the conceal-information words will not bedisplayed by the standard decoder.

On the other hand, an enhanced decoder 20 according to the firstembodiment extracts the conceal-information words from the replaced RSblock, as described later. Thereafter, correction is made using the RScode and the original-data section is extracted. According to theforegoing procedure, information is concealed in the QR code symbol 1.

Next, a concrete method for generating a QR code according to the firstembodiment will be described.

FIG. 4 is a flow chart of a method for generating a QR code symbolaccording to the first embodiment. FIG. 5 is a diagram illustrating a RSblock. FIG. 6 is a diagram illustrating conceal-information words. Inthe following description, unless otherwise stated, a procedure forencoding data to the QR code symbol 1 is a procedure in conformance withJIS is employed. Though a common QR code symbol 1 is composed of aplurality of RS blocks, one RS block will be described in this examplefor the purpose of explanation. Since the following description is givenas examples in order to simplify the explanation, the lengths of thesets of codewords will be, in some cases, different from those of actualQR code symbols.

The first embodiment assumes that the storage section 11 b stores:“offset information” indicating the beginning position at whichreplacement with conceal-information words starts (to be describedlater); and, “length (the number of words) information” of theconceal-information words.

First, original data and conceal-information words which are embedded inthe QR code symbol 1 are retrieved (S102). In this example, codewords ofthe original data is “TOKYO<cr>MINATO<cr>JPN” (FIG. 5), andconceal-information words are “00090012345678” (FIG. 6). Retrieving theoriginal data and the conceal-information words may be performed via theinput device 14, and also, information stored in advance in the storagesection 11 b may be used.

Next, the version of the QR code symbol 1 is determined according to theoriginal data and the conceal-information words (S104). According to itsversion, the total number of the codewords in the QR code symbol 1 isdetermined. The total number of the codewords is the sum of the numberof the correction codewords and the number of the data codewords; thenumber of the data codewords includes the number of the codewords of theoriginal data. Also, according to the version of the QR code symbol 1,the size and the number of the RS blocks, consisting of the datacodewords and the correction codewords, are determined. Error correctionis made for each of the RS blocks.

For example, If error correction is “level H” and version is “4”, thetotal number of the codewords is determined “100”. It is also determinedthat a QR code symbol 1 includes four RS blocks. The number of the datacodewords per RS block is “9”, and the number of the correctioncodewords per RS block is “16”.

The sum of the number of data codewords “9” and the number of correctioncodewords “16” is “25”. Since there are four RS blocks like this, a QRcode symbol of version “4” has 100 codewords in total: 25×4=100.

In this case, the number of error-correctable words per RS block is “8”.This means a capability of correcting “8” data codewords of total “9”data codewords. Since there are four RS blocks, the QR code symbol has acorrecting capability for 32 words in total: 4×8=32. It is possible tocorrect 32 words of 100 words, and this means that the QR code symbolhas correcting capability of 32% in total.

The replacement with conceal-information words is performed so that thenumber of the replace words in each RS block does not exceed the numberof error-correctable words in the RS block. In the foregoing case, “8”codewords for each RS block can be replaced, and “32” codewords in totalare allowed to be replaced (also referred to as “the total number ofreplaceable words”).

Based on the foregoing calculation, a version of the QR code symbol 1having a minimum size is selected in which the number of theconceal-information words does not exceed the total number ofreplaceable words, and in which the number of the codewords of theoriginal data does not exceed the number of the data codewords.

Next, RS blocks are generated according to the codewords of the originaldata (S106). In order to generate RS blocks, the codewords of theoriginal data is divided into a plurality of blocks. Error correctioncodewords are generated for each of the blocks, and the generatedcorrection codewords are added next to the corresponding codewords.Then, RS blocks are generated. A procedure for generating correctioncodewords can be in conformance with JIS.

FIG. 5 shows an example of an original data, a terminator, andcorrection codewords. In this example, plain-text information isillustrated as the codewords of the original data. As the terminator, asequence of bits “0000” may be employed, for example. A RS code whichhas been generated according to codewords including the original data isadded to generate a RS block.

A part of the RS block generated as mentioned above is replaced withconceal-information words (S108).

FIG. 7 is a first diagram illustrating how to replace a part of a RSblock in a procedure according to the first embodiment. FIG. 7 shows theforegoing RS block and conceal-information words. In the firstembodiment, as shown in FIG. 7, the RS block is replaced from itsinitial word with the conceal-information words based on the lengthinformation and the offset information of the foregoingconceal-information words.

If a part of a RS block is replaced with conceal-information words asmentioned above, a part of the original data is lost. However, sincecorrection can be made for each of the RS blocks, the standard decodercorrects, using a RS code, the original-data section which has beenreplaced. And, the original-data section can be appropriately extractedand displayed.

The part replaced with the conceal-information words is treated asinformation which is considered as an error and which is discarded, theerror being an error caused by contamination of the QR code symbol 1 orthe like. Consequently, the standard decoder cannot display theconceal-information words. On the other hand, the enhanced decoder 20extracts the conceal-information words from the replaced RS block, asdescribed later. Thereafter, correction is made using the RS code, andthe original-data section is extracted. Then, the extractedconceal-information words and the extracted original-data section aredisplayed.

Next, the QR code symbol 1 is generated based on the replaced RS block(S110). As a procedure for generating the QR code symbol 1 based on theRS block, a procedure similar to a standard procedure for generating aQR code in conformance with JIS may be employed. This makes it possibleto generate the QR code symbol 1.

Though, for the purpose of explanation, original data is plain-text datain the foregoing example, the data codewords of the original datathemselves may be interleaved or encrypted. Unreplaced RS block may begenerated by adding correction codewords to the original data which hasbeen interleaved or the original data which has been encrypted.Interleaving and encrypting mentioned above may be performed for eachbit of the original data, not for each codeword of the original data.

Also, the conceal-information words may be interleaved or encrypted. Theconceal-information words may be encoded for the purpose of errordetection or error correction (for example, coded into a RS code).

Next, a procedure for decoding the QR code symbol 1 generated asmentioned above will be described.

FIG. 8 is a block diagram of the enhanced decoder 20. The enhanceddecoder 20 is an apparatus reading the QR code symbol and expanding:conceal-information words and information which is to be displayed andcontained in the QR code symbol 1. The enhanced decoder 20 includes acontrol section 21, an imaging device 22, a display device 23, aprinting device 24 and an input device 25.

The control section 21 includes an operation section 21 a and a storagesection 21 b. The operation section 21 a is composed of units such as aCentral Processing Unit, and serves as executing programs and performingvarious operations. The storage section 21 b stores data necessary toexecute programs. In particular, the storage section 21 b stores aprogram for executing a method for reading a QR code (to be describedlater).

The imaging device 22 is a device for imaging the QR code symbol 1 suchas CCD camera or the like.

The display device 23 has a display function necessary at the time ofinputting data or the like. The display device 23 outputs by displayinginformation expanded from a QR code.

The printing device 24 outputs by printing such expanded information.The input device 25 is used for inputting data and is also used foroperating the enhanced decoder 20.

The configuration of the enhanced decoder 20 can be realized byinstalling a program to a common device having the imaging device 22like a computer, a mobile phone or a smartphone, the program being forexecuting a method for reading a QR code (to be described later). Theconfiguration can also be realized by combining the enhanced encoder 10and the enhanced decoder 20 mentioned above.

FIG. 9 is a flow chart of a method for reading a QR code symbolaccording to the first embodiment. In the following description, unlessotherwise stated, a procedure for decoding the QR code symbol 1 is aprocedure in conformance with JIS is employed.

The first embodiment assumes that the storage section 21 b of thedecoder 20 stores the “length (the number of words) information” ofconceal-information words, and “offset information” indicating thebeginning position at which replacement with the conceal-informationwords starts.

First, the QR code symbol 1 is read (S202). Then, a plurality of RSblocks is expanded based on the read QR code symbol 1 (S204). Concerningexpansion of the plurality of RS blocks, anything in conformance withJIS may be employed. Accordingly, for example, a replaced RS block shownin the FIG. 7 is acquired.

Next, the codewords and the conceal-information words of the originaldata are extracted from the acquired replaced RS block (S206).

FIG. 10 is a diagram illustrating a method for extractingconceal-information words. FIG. 10 shows a replaced RS block andconceal-information words.

The replaced RS block can be acquired by reading and expanding the QRcode symbol in conformance with JIS, as mentioned above. The decoder 20identifies the positions of the conceal-information words in thereplaced RS block, based on the offset information and the lengthinformation of the conceal-information words, both information beingstored in the storage section 21 b. The conceal-information words areextracted from the identified positions.

FIG. 11 is a diagram illustrating a method for extracting original data.The decoder 20 acquires an unreplaced RS block by performing errorcorrection of the replaced RS block. The decoder 20 extracts informationwhich is located from the initial end of the unreplaced RS block to aterminator, and the extract data will be treated as the original data.

Next, the obtained codewords of the original data and theconceal-information words are output (S208). These may be output to thedisplay device 23 or to the printing device 24 such as a printer.

If the data codewords of the original data themselves are interleaved asmentioned above, the data codewords are subsequently sorted in a certainprocedure so as to be in its original order. If the data codewords ofthe original data are encrypted, the original data is decoded in acertain decoding method.

Next, as an comparative example, an output result will be described in acase in which the standard decoder reads a QR code symbol 1 according tothe first embodiment. When the standard decoder reads the QR code symbol1, correction of the entire RS block is made according to the RS code ofthe replaced RS block. An original-data section is corrected, and thecorrected original data is displayed by the standard decoder. Unlike theforegoing enhanced decoder 20, the standard decoder does not have afunction to extract conceal-information words from the replaced RSblock. Accordingly, the standard decoder can extract the original dataonly, and cannot extract the conceal-information words.

Further, as a comparative example, an output result will be described ina case in which a common QR code symbol is read by the enhanced decoder20. When the enhanced decoder 20 reads a common QR code symbol, RSblocks can be acquired based on this. A RS block acquired from a commonQR code symbol does not include conceal-information words. However, atthe time of acquiring the RS block, the enhanced decoder 20 cannot judgewhether or not the read symbol 1 is a QR code symbol according to thefirst embodiment or is a common QR code symbol.

Accordingly, as in the procedure according to the first embodiment, theenhanced decoder 20 extracts data codewords as conceal-informationwords, from the positions where the conceal-information words of a RSblock are placed. Based on the RS code of the RS block, the entire RSblock is subsequently corrected. Consequently, the original-data sectionis corrected, and the corrected original data is displayed by theenhanced decoder 20.

The codewords which have been read as conceal-information words arejudged whether or not they are conceal-information words as follow. Ifthe ratio of difference between a RS block before correction and a RSblock after correction exceeds a predetermined value, it can be judgedthat the codewords which have been read are conceal-information words(that is, it can be judged that the QR code symbol is a QR code symbolaccording to the first embodiment). If the ratio of difference does notexceed the predetermined value, it can be judged that the codewords arenot conceal-information words (that is, it can be judged that the QRcode symbol is a common QR code symbol), and it is possible not todisplay conceal-information words. This is because the ratio ofdifference between an unreplaced RS block and a replaced RS block alwaysexceeds a predetermined value if replacement with conceal-informationwords is performed.

As another comparative example, the following case will be considered:after a common QR code symbol is generated, graphic pattern is generatedin only a part corresponding to specific conceal information and tooverwrite the graphic pattern. In this case, after generating atwo-dimensional pattern, a specific graphic pattern is generated.Accordingly, a different system for generating such a specific graphicpattern is required. In addition, after generating a QR code symbol, ageneration process for a graphic pattern to overwrite is needed. Interms of processing speed, the foregoing processes are not desirablebecause a plurality of processes for graphic-pattern generation areperformed.

Unlike the comparative examples, in the first embodiment, the enhancedencoder 10 generates a replaced data block immediately after theenhanced encoder 10 generates an unreplaced data block at thedata-codeword level. This process is performed on a memory (the storagesection 11 b) of a single system (the control section 11). Based on theforegoing replaced data block, a final process for generating a QR codesymbol 1 is performed only once (S110). Since necessary processes areperformed at the data-codeword level as mentioned above, the finalprocess for generating a QR code symbol 1 can be performed moreefficiently and at higher speed than in the foregoing case in whichnecessary processes are performed at graphic-pattern-generation level.These advantages exist also in the following embodiment.

FIG. 12 is a second diagram illustrating how to replace a part of a RSblock in a procedure according to the first embodiment. In the foregoingprocedure, the RS block is replaced sequentially from its initial wordwith conceal-information words. However, taking into consideration thecorrecting capability of Reed-Solomon code, any positions in the RSblock may be replaced with conceal-information words.

In this case, it is possible to predetermine a position of the RS blockat which replacement with the conceal-information words starts (how manywords from the initial word to the position). For example, as shown inFIG. 12, a RS block may be replaced with 13 conceal-information wordsfrom the replacement start position, which is of the seventh word fromthe initial word. In this case, the storage section 11 b of the enhancedencoder 10 and the storage section 21 b of the enhanced decoder 20 storethe offset information that the conceal-information words starts fromthe position of seventh word in the replaced RS block, the positionhaving been predetermined. Also, these storage sections store lengthinformation that the length of the conceal-information words is 13words. In this case, since the number of conceal-information words issmaller than the number of words which can be corrected with the RScode, correcting makes it possible to appropriately acquire anunreplaced RS block. It is possible to extract the original data fromthe unreplaced RS block.

In this case, the final end of the conceal-information words with whichthe RS block has been replaced may be defined by adding a certainseparator to the final word of conceal-information words.

FIG. 13 is a third diagram illustrating how to replace a part of a RSblock in a procedure according to the first embodiment. In this example,parts of a RS block are replaced with conceal-information words whichare divided into multiple parts.

In this case, it is possible to predetermine a plurality of positionsfrom which the RS block is to be replaced with the parts ofconceal-information words. For example, as shown in FIG. 13, thefollowing replacements are acceptable. The RS block is replaced withthree conceal-information words from a replacement start position, whichis of 3rd word from the initial word. And, the RS block is replaced withtwo conceal-information words from a replacement start position, whichis of eighth word from the initial word. And, the RS block is replacedwith one conceal-information word from a replacement start position,which is of 11th word from the initial word. And, the RS block isreplaced with four conceal-information words from a replacement startposition, which is of 16th word from the initial word. And, the RS blockis replaced with three conceal-information words from a replacementstart position, which is of 22th word from the initial word.

In this case, the storage section 11 b of the enhanced encoder 10 andthe storage section 21 b of the enhanced decoder 20 stores the foregoinginformation as the offset information and as the length information.Accordingly, the enhanced decoder 20 can extract each part of theconceal-information words from the corresponding positions, which areidentified in advance. Also in this case, since the number ofconceal-information words is smaller than the number of words which canbe corrected with the RS code, correction allows the unreplaced RS blockto be appropriately acquired. It is possible to extract the originaldata from the unreplaced RS block.

===Second Embodiment===

In the foregoing first embodiment, information of the positions of theoffset information and the length information of conceal-informationwords is stored in advance in the storage section 11 b of the enhancedencoder 10 and in the storage section 21 b of the enhanced decoder 20(the information of the positions is hereinafter referred to asplacement information). In the second embodiment, placement informationis stored in header data codewords (a “header” in the drawings). Inaddition, the header data codewords are contained in a replaced RS blockin the second embodiment.

FIG. 14 is a conceptual diagram of a RS block according to the secondembodiment. As known from a comparison FIG. 14 with FIG. 3, which isaccording to the foregoing first embodiment, in the second embodiment,the enhanced encoder 10 replaces a part of an unreplaced RS block withheader data codewords and conceal-information words, and generates areplaced RS block.

In the second embodiment, a replacement with the header data codewordsand a replacement with the conceal-information words, both are performedso that the number of the replaced words does not exceed the number oferror-correctable words in the RS block. That is, the total number ofthe header data codewords and the conceal-information words does notexceed the number of error-correctable words in the RS block.

The header data codewords shown in FIG. 14 contains placementinformation of the conceal-information words, as mentioned above.Accordingly, with reference to the header data codewords, it is possibleto locate the beginning position of the conceal-information words andits length (the number of words). The positions of the header datacodewords are predetermined. In addition, the header data codewords cancontain information related to the format of the conceal-informationwords. Information related to the format of the conceal-informationwords contains the following types of information: information of acryptographic key which is used if the conceal-information words areencrypted; and information of sorting which is performed if theconceal-information words are interleaved. If the conceal-informationwords are encoded for the purpose of error detection or errorcorrection, information of a procedure for error detection or errorcorrection is also contained.

FIG. 15 is a diagram illustrating header data codewords andconceal-information words according to the second embodiment. FIG. 15shows the header data codewords and the conceal-information words, andalso shows that the conceal-information words contain correction-codewords.

FIG. 16 is a first diagram illustrating how to replace a part of a RSblock in a procedure according to the second embodiment. FIG. 16 shows aRS block, conceal-information words, and header data codewords. In thisexample, as shown in FIG. 16, the RS block is replaced from its initialword with the conceal-information words by the enhanced encoder 10. Thefinal end part of the RS block is replaced with the header datacodewords. The header data codewords contains placement information ofthe conceal-information words (in this case, information that thebeginning of the conceal-information words is the initial word of the RSblock (zero offset), and information that the length is 11 words).

If a part of a RS block is replaced with the conceal-information wordsas mentioned above, a part of the original data and a part of thecorrection codewords are lost. However, correction can be made for eachof RS blocks. Accordingly, using a RS code, the standard decoder cancorrect the original-data section which has been replaced. And, thestandard decoder can appropriately extract and display the original-datasection. The part which is replaced with the conceal-information wordsis treated as information which is considered as an error and which isdiscarded, the error being an error caused by contamination of the QRcode symbol 1 or the like. Consequently, the standard decoder cannotdisplay the conceal-information words.

On the other hand, the enhanced decoder 20 extracts theconceal-information words from the replaced RS block. And, the enhanceddecoder 20 acquires from the header data codewords, placementinformation which is for locating the positions of theconceal-information words. Based on the placement information, theconceal-information words are extracted. Since the correction-code wordsare added to the conceal-information words, the contaminatedconceal-information words can be corrected using the correction-codewords.

If the conceal-information words are interleaved, theconceal-information words can be sorted in its original order based onthe information of an interleaving procedure contained in the headerdata codewords. Also, if the original data is interleaved, the originaldata can be sorted in its original order based on the information of aninterleaving procedure contained in the header data codewords. If theconceal-information words are encrypted, the conceal-information wordscan be decoded based on a cryptographic key contained in the header datacodewords or the like. As mentioned above, if the conceal-informationwords are encoded for the purpose of error detection or error correction(for example, coded into a RS code), a procedure for correcting an errorcan be specified based on information contained in the header datacodewords.

After the conceal-information words are extracted as mentioned above,the enhanced decoder 20 corrects the replaced RS block and obtains anunreplaced RS block. Then, the original-data section contained in theunreplaced RS block is extracted. And, the conceal-information words andthe original-data section which have been extracted are displayed.

FIG. 17 is a second diagram illustrating how to replace a part of a RSblock in a procedure according to the second embodiment. In theprocedure shown in FIG. 16, the RS block is replaced sequentially fromits initial word with conceal-information words. However, as shown inFIG. 17, the RS block may be replaced, from any position which is not ofthe initial word, with conceal-information words.

In a case shown in FIG. 17, offset information in the header datacodewords contains that the RS block is replaced with theconceal-information words from the 9th word of the RS block. Also,length information in the header data codewords contains that the lengthof the conceal-information words is 11 words. This makes it possible toappropriately extract the conceal-information words by referring theheader data codewords, as in the first embodiment.

This also can be applied to a case in which the RS block is replacedwith separated conceal-information words as shown in the foregoing FIG.13.

FIG. 18 is a third diagram illustrating how to replace a part of a RSblock in a procedure according to the second embodiment. In thisexample, it is predetermined that the beginning position of the headerdata codewords is the 13th word of the RS block, and it is predeterminedthat the length of the header data codewords is two words. If the RSblock is replaced with the separated conceal-information words asmentioned above, the header data codewords contain a plurality of piecesof placement information of the conceal-information words. This makes itpossible to appropriately extract the conceal-information words withreference to the header data codewords.

In the foregoing description, the positions of the header data codewordsare predetermined. However, the positions of the header data codewordsmay be indicated by delimiters which are respectively placed adjacent tothe header data codewords on both sides of the header data codewords.

Concerning whether the read QR code symbol is a common QR code symbol oris a QR code symbol according to the second embodiment, the judgment canbe made based on whether or not the extracted conceal-information wordsinclude header data codewords. That is, since a QR code symbol accordingto the second embodiment contains header data codewords, the enhanceddecoder 20 can display conceal-information words. On the other hand,since a common QR code symbol does not contain a header data codeword,the enhanced decoder 20 can display only information to be displayedwithout displaying the conceal-information word.

===Third Embodiment===

FIG. 19 is a diagram illustrating how to replace a part of a RS block ina procedure according to the third embodiment. FIG. 19 shows anunreplaced RS block, conceal-information words, a temporary replaced RSblock, header data codewords and a replaced RS block.

In the third embodiment, the enhanced encoder 10 replaces a part of theunreplaced RS block with the conceal-information words, and generatesthe temporary replaced RS block. The conceal-information words includethe correction-code words, which have a correcting capabilitysufficiently to correct words replaced with the header data codewords,as described later.

Next, the enhanced encoder 10 replaces a part of the temporary replacedRS block with the header data codewords, the part of the temporaryreplaced RS block being a part of the replaced words which have beenreplaced with the conceal-information words. And, the enhanced encoder10 generates the replaced RS block. Subsequently, the enhanced encoder10 generates a QR code symbol based on the generated replaced RS block.

Next, a decoding procedure will be described. The enhanced decoder 20according to the third embodiment reads a QR code symbol generated asmentioned above, and expands a replaced RS block. Then, the enhanceddecoder 20 extracts the header data codewords. The positions of theheader data codewords may be predetermined as in the first embodimentand the second embodiment. Also, the positions of the header datacodewords may be indicated by delimiters which are respectively placedadjacent to the header data codewords on both sides of the header datacodewords.

Based on placement information contained in the header data codewordswhich has been extracted as mentioned above, the positions of theconceal-information words are identified, and then theconceal-information words are extracted. Since the conceal-informationwords contains correction-code words as mentioned above, correctionbased on the correction-code words allows to appropriately correct apart which has been replaced with the header data codewords. Thus, theconceal-information words before being replaced with header datacodewords are appropriately extracted.

This makes it possible to acquire a temporary replaced RS block. Next,the decoder 20 performs a correcting operation using correction-codewords, the correction-code word being included in the unreplaced RSblock. Thus, a part replaced with the conceal-information word isappropriately corrected, and the unreplaced RS block can be acquired.Then, the enhanced decoder 20 can extract the original data from theunreplaced RS block.

In the third embodiment, the number of conceal-information words doesnot exceed the number of words which can be corrected withcorrection-code words included in the unreplaced RS block. In the thirdembodiment, the number of header data codewords does not exceed thenumber of words which can be corrected with correction-code wordscontained in the conceal-information words. This makes it possible toextract appropriately the conceal-information word and the originaldata.

In the third embodiment, a part of replaced words which have beenreplaced with the conceal-information words is replaced with header datacodewords. For this reason, the header data codewords overlap theconceal-information words. Accordingly, the total length of the headerdata codewords and the conceal-information words can be reduced. Thismakes it possible to increase reserve capability for detecting andcorrecting an error of the QR code symbol.

In the third embodiment, as in the second embodiment, concerning whetherthe read QR code symbol is a common QR code symbol or is a QR codesymbol according to the third embodiment, the judgment can be made basedon whether or not the extracted conceal-information words include headerdata codewords. That is, since a QR code symbol according to the thirdembodiment contains header data codewords, the enhanced decoder 20 candisplay conceal-information words. On the other hand, since a common QRcode symbol does not contain header data codewords, the enhanced decoder20 can display only information to be displayed without displayingconceal-information words.

===Fourth Embodiment===

FIG. 20 is a diagram illustrating how to replace a part of a RS block ina procedure according to the fourth embodiment. FIG. 20 shows anunreplaced RS block, conceal-information words and a replaced RS block.

In the fourth embodiment, the original data of the unreplaced RS blockcontains header data codewords. Delimiters (each indicated as “<deli>”in FIG. 20) are placed adjacent to the header data codewords on bothsides of the header data codewords. These delimiters separateinformation to be displayed and the header data codewords in theoriginal data.

In order to generate the foregoing unreplaced RS block, in the fourthembodiment, the enhanced encoder 10 generates original data, whichincludes information to be displayed, header data codewords, anddelimiters. The header data codewords contain the placement informationof conceal-information words (to be described later). The enhancedencoder 10 generates the correction codewords based on the original datacomposed of them (including padding codewords, if any). And, theenhanced encoder 10 generates the unreplaced RS block.

Next, the enhanced encoder 10 replaces a part of the unreplaced RS blockwith the conceal-information words. The replacement positions arepositions corresponding to the placement information, which is containedin the header data codewords. The enhanced encoder 10 generates thereplaced RS block. Subsequently, the enhanced encoder 10 generates a QRcode symbol based on the replaced RS block.

Next, a decoding procedure will be described. The enhanced decoder 20according to the fourth embodiment reads a QR code symbol generated asmentioned above, and expands a replaced RS block. Then, the enhanceddecoder 20 corrects the replaced RS block based on the correction-codewords which are included in the unreplaced RS block, and thereby anunreplaced RS block can be acquired. The unreplaced RS block includesthe header data codewords separated by the delimiters, as mentionedabove. The enhanced decoder 20 locates the positions of theconceal-information words and extracts the conceal-information wordsfrom the replaced RS block based on the placement information, theplacement information being included in the header data codewords. Theextracted conceal-information words may be corrected using thecorrection-code words which are included in the conceal-informationwords.

Header data codewords, which contain the placement information ofconceal-information words, are replaced with conceal-information wordsas mentioned above, and the replaced RS block is consequently generated.This makes it difficult to locate the positions of conceal-informationwords in the replaced RS block. This can make it more difficult for athird party to extract conceal-information words.

In the fourth embodiment, concerning whether the read QR code symbol isa common QR code symbol or is a QR code symbol according to the fourthembodiment, the judgment can be made based on whether or not theextracted unreplaced RS block includes header data codewords. That is,since the unreplaced RS block according to the fourth embodimentincludes header data codewords, the enhanced decoder 20 can displayconceal-information words. On the other hand, since a common QR codesymbol does not include header data codewords, the enhanced decoder 20can display only information to be displayed without displaying theconceal-information words.

===Fifth Embodiment===

FIG. 21 is a diagram illustrating how to replace a part of a RS block ina procedure according to the fifth embodiment. FIG. 21 shows anunreplaced RS block, conceal-information words, header data codewordsand a replaced RS block.

In the fifth embodiment, the original data of the unreplaced RS blockcontains header-offset-position-information words, which contain theposition information of header data codewords (indicated as “<OFFSET>”in FIG. 21 and corresponding to the “header-position-data codeword”).Delimiters are respectively placed adjacent to theheader-offset-position-information words on both sides of theheader-offset-position-information words. These delimiters separateinformation to be displayed and the header-offset-position-informationwords in the original data.

In order to generate the foregoing unreplaced RS block, in the fifthembodiment, the enhanced encoder 10 generates original data, whichincludes information to be displayed, header-offset-position-informationwords, and delimiters. The enhanced encoder 10 generates the correctioncodewords based on the original data composed of them (including paddingcodewords, if any). And, the enhanced encoder 10 generates theunreplaced RS block.

Next, the enhanced encoder 10 replaces a part of an unreplaced RS blockwith conceal-information words. The replacement positions are positionscorresponding to the placement information of the conceal-informationwords, the placement information being contained in the header datacodewords. In this example, the placement information ofconceal-information words contains information that replacement with theconceal-information words starts from the fifth word of the RS block,and that the length of the conceal-information words is 11 words. And,the enhanced encoder 10 generates a temporary replaced RS block.

Next, the enhanced encoder 10 replaces with the header data codewords apart of the conceal-information words in the temporary replaced RSblock. The replacement positions are positions corresponding to theposition information of the header data codewords, the positioninformation being contained in the header-offset-position-informationwords. In this example, the header-offset-position-information wordscontain information that replacement is performed from the seventh wordof the RS block. The length of the header data codewords is set to twowords in advance. Based on these pieces of information, the enhancedencoder 10 replaces the RS block with the header data codewords, and theenhanced encoder 10 generates the replaced RS block. Subsequently, theenhanced encoder 10 generates a QR code symbol based on the replaced RSblock.

Next, a decoding procedure will be described. The enhanced decoder 20according to the fifth embodiment reads a QR code symbol generated asmentioned above, and expands a replaced RS block. Then, the enhanceddecoder 20 corrects the replaced RS block based on correction-code wordswhich are included in the RS block, and thereby an unreplaced RS blockcan be acquired. The unreplaced RS block includes theheader-offset-position-information words separated by the delimiters, asmentioned above.

Based on the header-offset-position-information words, the enhanceddecoder 20 locates the positions of the header data codewords in thereplaced RS block. The enhanced decoder extracts the header datacodewords from the located positions in the replaced RS block, andthereby the placement information of the conceal-information word can beacquired.

The enhanced decoder 20 extracts the conceal-information words from thereplaced RS block based on the placement information of theconceal-information words. However, a part of the conceal-informationwords is replaced with the header data codewords. Accordingly, theenhanced decoder 20 performs correction based on the correction-codewords, the correction-code words being contained in theconceal-information words. Consequently, the conceal-information wordsbefore being replaced with the header data codewords can be acquired.This makes it possible to acquire appropriately conceal-informationwords.

Further, the enhanced decoder 20 acquires information words which areobtained by removing the header-offset-position-information words anddelimiters from the original data of the unreplaced RS block.

Thus, the header-offset-position-information words, which indicate thepositions of the header data codewords, are contained in the originaldata. In addition, the header-offset-position-information words arereplaced with the conceal-information words. These make it moredifficult to locate the positions of the conceal-information words.Accordingly, it can be more difficult for a third party to extract theconceal-information words.

As in the foregoing second embodiment, any positions in the RS block maybe replaced with the conceal-information words based on the placementinformation of the conceal-information words, the placement informationbeing contained the header data codewords. In addition, the RS block maybe replaced with the conceal-information words which are divided intomultiple parts. It is possible to encrypt or interleave theconceal-information words, based on information of the header datacodewords.

Though the positions of the header data codewords is located based on“offset”, the positions of the header data codewords may be located inanother procedure.

In the fifth embodiment, as in the second embodiment, concerning whetherthe read QR code symbol is a common QR code symbol or is a QR codesymbol according to the fifth embodiment, the judgment can be made basedon whether or not the extracted conceal-information words include headerdata codewords. That is, since a QR code symbol according to the fifthembodiment contains header data codewords, the enhanced decoder 20 candisplay conceal-information words. On the other hand, since a common QRcode symbol does not contain header data codewords, the enhanced decoder20 can display only information to be displayed without displaying theconceal-information words.

===Sixth Embodiment===

FIG. 22 is a first diagram illustrating how to replace a part of a RSblock in a procedure according to the sixth embodiment. FIG. 22 shows anunreplaced RS block, conceal-information words and a replaced RS block.

In the sixth embodiment, the enhanced encoder 10 generates thecorrection codewords based on original data (including paddingcodewords, if any). And, the enhanced encoder 10 generates theunreplaced RS block. Next, the enhanced encoder 10 replaces a part ofthe unreplaced RS block with the conceal-information words. Then, theenhanced encoder generates the replaced RS block, and generates a QRcode symbol based on the replaced RS block. Thus, in the sixthembodiment, a method for generating a QR code symbol has almost the sameprocedure as in the first embodiment.

Next, a decoding procedure will be described. The enhanced decoder 20according to the sixth embodiment reads the QR code symbol generated asmentioned above, and expands the replaced RS block. The enhanced decoder20 corrects the replaced RS block based on the correction-code words,which is included in the RS block, and thereby the unreplaced RS blockis acquired.

The enhanced decoder 20 compares the unreplaced RS block with thereplaced RS block. Then, the enhanced decoder 20 extracts a part of thereplaced RS block, the part being different from the unreplaced RSblock. The information words extracted as mentioned above serve as theconceal-information words. The original data is extracted from theunreplaced RS block. Since a terminator is placed in the unreplaced RSblock between the original data and the correction-code words, thedecoder 20 can separate the original data and the correction-code wordsaccording to the terminator.

This makes it possible to extract the conceal-information words and theoriginal data. With a procedure according to the sixth embodiment, it issufficient that a comparison is merely made between the unreplaced RSblock and the replaced RS block to extract a part having a difference.Accordingly, it is not advantageously necessary to provide the placementinformation of the conceal-information words. That is, if the headerdata codewords are used, the number of the header data codewords candecrease.

FIG. 23 is a second diagram illustrating how to replace a part of a RSblock in a procedure according to the sixth embodiment. In this example,parts of a RS block are replaced with conceal-information words whichare divided into multiple parts.

For example, as shown in FIG. 23, the conceal-information words can bedivided into five parts and parts of RS block can be replaced with them.In this case, since the number of the conceal-information words issmaller than the number of words which can be corrected with the RScode, it is possible to appropriately acquire the unreplaced RS block byperforming correction. In this case, it is possible to acquire theconceal-information words by obtaining the difference between theunreplaced RS block and the replaced RS block. And, the original datacan be acquired by extracting data words from the positions in theunreplaced RS block, which are identified in advance.

The foregoing procedure in which the conceal-information words areextracted based on the difference is effective, in particular, in casesin which a QR code symbol and its RS blocks are less likely to becontaminated. For example, in cases in which an image data file of a QRcode symbol is generated and then the file is retrieved to extractconceal-information words, the QR code symbol will not be contaminatedbecause there is no chance that the QR code symbol is exposed outside.

The foregoing procedure has an advantage that conceal-information wordscan be identified without providing a header data codeword or the like.This makes it possible to replace a RS block with moreconceal-information words.

As in the first embodiment, the codewords which have been read asconceal-information words are judged whether or not they areconceal-information words as follow. If the ratio of difference betweena RS block before correction and a RS block after correction exceeds apredetermined value, it can be judged that the codewords which have beenread are conceal-information words (that is, it can be judged that theQR code symbol is a QR code symbol according to the sixth embodiment).If the ratio of difference does not exceed the predetermined value, itcan be judged that the codewords are not conceal-information words (thatis, it can be judged that the QR code symbol is a common QR codesymbol), and it is possible not to display conceal-information words.This is because the ratio of difference between an unreplaced RS blockand a replaced RS block always exceeds a predetermined value ifreplacement with conceal-information words is performed.

If decoding is performed based on the difference in the foregoingprocedure, there is a problem that a part of an unreplaced data blockwill not be extracted as a difference, which is accidentally identicalto a part of a replaced data block which has been replaced withconceal-information words (but, this is extremely rare). In this case,it is assumed that the words contained in header data codewords and inconceal-information words are always replaced without being separated.

FIG. 24 is a third diagram illustrating how to replace a part of a RSblock in a procedure according to the sixth embodiment. In this example,the rule that the header data codewords and the conceal-informationwords are placed continuously is applied. Because of this rule, thesewords are always replaced continuously. Accordingly, even ifaccidentally-identical words are lost, the information can be restoredby filling the lost part with the accidentally-identical words.

It is sufficient that, if codewords which are located at positionsexcept for the ends of a RS block are lost, the lost parts are filledwith the data codewords which are located at corresponding positions.However, if codewords which are located at an end of a RS block arelost, it is difficult to identify whether the loss has occurred at theinitial end or at the final end. In this case, several restorations areperformed for the end and are verified, as to be mentioned below.

FIG. 25 is a diagram illustrating RS blocks a part of which is lost.FIG. 25 shows the following four types of RS blocks: a RS block withoutany loss; a RS block having a loss at the initial end of the datacodewords (hereinafter referred to as an initial-end-loss RS block); aRS block having a loss at the final end of correction codewords(hereinafter referred to as a final-end-loss RS block); and a RS blockhaving losses at both ends (hereinafter referred to as a two-end-loss RSblock). For the purpose of explanation, there is no codeword in eachcell. In these figures, the lost codewords are indicated by dashedlines. Thus, concerning the cases in which loss occurs at an end or endsof a RS block, there are three types.

For the initial end and the final end of such a RS block, there arepossible combinations of restoration patterns. All restorationcombinations are performed and are verified as follow: (1) whethercorrection can be processed for the restored RS block and (2) if thecorrection is processed, whether a result of the correction has acorrect block syntax.

FIG. 26 is a diagram illustrating how to restore an initial-end-loss RSblock. FIG. 26 shows the initial-end-loss RS block which is wronglyrestored. In the initial-end-loss RS block, the initial end of the RSblock should be restored. But, from appearance of a RS block having aloss, it cannot be judged that whether the loss occurs at the initialend or at the final end. Accordingly, a RS block whose initial end isrestored is generated, and also a RS block whose final end is restoredis generated. These two RS blocks which have been restored will undergocorrection using correction codewords.

Since the RS block whose initial end is restored is a correct RS block,correction is appropriately processed, and a result of the correctionhas a correct block syntax.

On the other hand, as shown in FIG. 26, in a RS block whose final end isrestored, the positions of correction codewords are estimated based onthe expected length of words. As a result, the wrong positions areidentified as the positions of correction codewords. Correction isperformed based on the codewords in a region which is wrongly recognizedas correction codewords in the foregoing way. Accordingly, correction isnot appropriately processed.

In this example, it is assumed that a loss of one codeword occurs. But,if a plurality of codewords are lost, the wrong positions are identifiedas the positions of correction codewords. Accordingly, correction is notappropriately processed.

FIG. 27 is a diagram illustrating how to restore the final-end-loss RSblock. FIG. 27 shows the final-end-loss RS block which is wronglyrestored. In the final-end-loss RS block, the final end of the RS blockshould be restored. But, from appearance of a RS block having a loss, itcannot be judged that whether the loss occurs at the initial end or atthe final end. Also in this case, a RS block whose initial end isrestored is generated, and a RS block whose final end is restored isgenerated. These two RS blocks which have been restored will undergocorrection using correction codewords.

Since the RS block whose final end is restored a correct RS block,correction is appropriately processed, and a result of the correctionhas a correct block syntax.

On the other hand, as shown in FIG. 27, in a RS block whose initial endis restored, the positions of correction codewords are estimated basedon the expected length of words. As a result, the wrong positions areidentified as the positions of correction codewords. Correction isperformed based on the codewords in a region which is wrongly recognizedas correction codewords in the foregoing way. Accordingly, correction isnot appropriately processed.

In this example, it is assumed that a loss of one codeword occurs. But,if a plurality of codewords are lost, the wrong positions are identifiedas the positions of correction codewords. Accordingly, correction is notappropriately processed.

FIG. 28 is a diagram illustrating how to restore the two-end-loss RSblock. FIG. 28 shows two-end-loss RS blocks which are wrongly restored.In this example, it is assumed that a loss of one codeword occurs ateach end. In the two-end-loss RS block of these types, each of one-wordlosses at the initial end and at the final end should be restored. But,also in this case, from appearance of a RS block having losses, itcannot be judged how the loss occurs.

Accordingly, in this case, the following RS blocks are generated: a RSblock in which two words at the initial end are restored; a RS block inwhich two words at the final end are restored; and a RS block in whichtwo words respectively located at the initial and final ends arerestored. For each of the restored RS blocks, correction is performedusing a correcting block. A method for verification, which issubsequently performed, is the same as in a case in which theinitial-end-loss RS block is restored and as in a case in which thefinal-end-loss RS block is restored. The description thereof willtherefore be omitted.

As mentioned above, by restoring in all possible patterns and verifyingthe restoring, it is possible to acquire a RS block which has beenappropriately restored.

In this example, though the foregoing three types of the cases aredescribed, the number of times of verifications changes depending on thenumber of lost data codewords.

For example, if one data codeword is lost as mentioned above, there aretwo possible cases: a case in which one codeword at the initial end islost; and a case in which one codeword at the final end is lost.

If two data codewords are lost, there are three possible cases: a casein which two codewords at the initial end are lost; a case in which twocodewords at the initial end are lost and one codeword at the final endis lost; and a case in which two codewords at the final end are lost.

If three data codewords are lost, there are four possible cases: a casein which three data codewords at the initial end are lost; a case inwhich two codewords at the initial end are lost and one codeword at thefinal end is lost; a case in which one codeword at the initial end islost and two codewords at the final end are lost; a case in which threedata codewords at the final end are lost.

According to this regularity, if N codewords are lost at the ends intotal, (N+1) types of verifications are performed. As a result of (N+1)types of verifications, it is possible to employ a RS block which hasbeen appropriately corrected.

Thus, even if a case in which loss occurs at the initial end or at thefinal end, it is possible to appropriately restore the correct RS blockby generating and verifying RS blocks which have been restoredcorresponding to the case. There is extremely rarely possible that a RSblock which has been wrongly restored is corrected without trouble. Inthis case, however, the corrected block has a problem such that it isnot satisfy the predetermined format. Accordingly, based on this, it canbe judged that the block is not appropriately restored.

===Seventh Embodiment===

In the seventh embodiment, when an unreplaced RS block is replaced withconceal-information words, replacement is performed from the positionwhich is of the word corresponding to the number of words identified bya mask pattern reference MPR. The mask pattern reference MPR is areference which identifies a mask pattern in conformance with JIS (inthis description, referred to as a “standard mask pattern”). In theseventh embodiment, the replacement positions of the conceal-informationwords are located using the mask pattern reference MPR, and consequentlythis makes it more difficult for a third party to extract theconceal-information words.

The mask pattern reference MPR is contained in format information FI ofthe QR code symbol 1. The format information FI also contains errorcorrection level. According to JIS, masking with a standard mask patternis applied to only a part of the encoding region which is neither anarea of format information FI nor an area of version information. Thatis, the mask pattern reference MPR is not masked by the standard maskpattern.

FIG. 29 is a flow chart of a method for generating a QR code symbolaccording to the seventh embodiment. A method for generating a QR codesymbol according to the seventh embodiment will be described below withreference to the flow chart.

First, original data and conceal-information words which are embedded inthe QR code symbol 1 are retrieved (S302). Next, according to theoriginal data and the conceal-information words, the version of the QRcode symbol 1 is determined (S304). Next, RS blocks are generatedaccording to the codewords of the original data (S306). In these stepsS302 to S306, a procedure for retrieving the original data and theconceal-information words, a procedure for determining the version, anda procedure for generating a RS block are the same as in the firstembodiment. The description thereof will therefore be omitted.

Next, the value of the mask pattern reference MPR is reset to “0”(S308). With a mask pattern reference MPR in conformance with JIS, thevalue of the mask pattern reference MPR is within the range from 0 to 7(from “000” to “111”). In this example, the value of the mask patternreference MPR changes from 0 to 7, and the processes from step S310 tostep S314 (to be described later) are repeatedly performed. For thisreason, the value of the mask pattern reference MPR is reset to “0”.

Next, the replacement with the conceal-information words is performed atthe positions (replacement positions) which the mask pattern referenceMPR locates (S310). In this example, the replacement with theconceal-information words is performed from the position which is of theword corresponding to the value of the mask pattern reference MPR fromthe initial word of the unreplaced RS block. For example, if the valueof the mask pattern reference MPR is “0”, the unreplaced RS block isreplaced from its initial word with the conceal-information words. Asmentioned above, the value of the mask pattern reference MPR is withinthe range from 0 to 7. Accordingly, the mask pattern reference MPR canidentify 8 types of positions as the replacement position of theconceal-information words.

FIG. 30 is a diagram illustrating how to replace a part of a RS block ina procedure according to the seventh embodiment. FIG. 30 shows a case inwhich the value of the mask pattern reference MPR is “6” and in whichthe unreplaced RS block is replaced with the conceal-information wordsfrom the position which is of 6th word (six-word offset).

There is a procedure in which the replacement positions withconceal-information words is positions which are of the wordscorresponding to the value of mask pattern reference MPR, and theprocedure is one of the simplest procedure for locating the replacementpositions by the mask pattern reference MPR. However, the embodiment isnot limited thereto. The replacement positions may be identified basedon a position which is predetermined according to the value of the maskpattern reference MPR.

Next, as mentioned above, a QR code symbol before applying a standardmask pattern is generated based on the replaced RS block, in which apart of RS block is replaced (S312). To the QR code symbol beforeapplying a standard mask pattern, a standard mask pattern is applied,the standard mask pattern being identified by the mask pattern referenceMPR (S314). Applying a standard mask pattern is in conformance with JIS,and the description will be omitted.

Next, it is judged whether the value of the mask pattern reference MPRis 7 or not (S316). Accordingly, in all cases in which the value of themask pattern reference MPR is different between 0 and 7, it is judgedwhether the processes from step S310 to step S314 have been performed ornot. In step S316, if the value of the mask pattern reference MPR is not“7”, the value of the mask pattern reference MPR increments (S318).

On the other hand, in step S316, if the value of the mask patternreference MPR is “7”, all QR code symbols have been generated whichrespectively correspond to the value of the mask pattern reference MPRfrom 0 to 7. And, these eight QR code symbols are evaluated and theoptimal pattern of the QR code symbol is determined (S320).

Concerning evaluation of QR code symbols in step S320, “Evaluation ofmasking result” of JIS is applied thereto, and the description thereofwill be omitted. By this evaluation, it is possible to specify a QR codesymbol whose modules scatters reasonably.

Next, the QR code symbol which has been identified in step S320 isoutput (S320). The output QR code symbol may be displayed by the displaydevice 13, and may be printed by the printing device 14.

Accordingly, the mask pattern reference MPR, which identifies thestandard mask pattern applied to the QR code symbol, is used to locate aposition of the RS block which is replaced with conceal-informationwords. Since there are 8 types of the standard mask patterns, the valueof the mask pattern reference MPR can have 8 types of numbers. Dependingon the applied standard mask pattern, it is therefore possible to changethe replacement positions of the conceal-information words. This makesit difficult for a third party to locate the positions of theconceal-information words, and therefore it can be further difficult toextract the conceal-information words.

If a procedure according to the seventh embodiment is used, the QR codesymbol in which the conceal-information words are placed at the optimalpositions can be found at a time of evaluating in step S320 all QR codesymbols which are each generated based on a different value of the maskpattern reference MPR from 0 to 7. Accordingly, until the evaluation ofstep S320, a QR code symbol which is to be employed cannot be decidedamong QR code symbols in which replacement positions with theconceal-information words are different. As mentioned above, thereplacement positions with the conceal-information words cannot bedetermined in advance. This makes it more difficult to locate thepositions of the conceal-information words, and therefore it can befurther difficult to extract conceal-information words.

A standard mask pattern can be applied before replacement withconceal-information words in step S310. However, in terms of scatteringmodules in QR code symbol, it is desirable that a standard mask patternis applied after replacement with conceal-information words in stepS310.

In the same manner as in the foregoing first embodiment, masking withthe standard mask pattern is performed after step S108. In this case,all standard mask patterns, each of which has a mask pattern referenceMPR between “0” and “7”, are applied. As in step S320 according to theseventh embodiment, the optimal QR code symbol will be selected amongthese QR code symbols.

Masking with the standard mask pattern is applied to only a part of theencoding region which is neither an area of format information FI nor anarea of version information VI. Accordingly, the mask pattern referenceMPR is not affected by masking with the standard mask pattern. At thetime of reading a QR code symbol, it is possible to remove the standardmask pattern by appropriately read a mask pattern reference MPR fromformat information FI.

Next, a method for reading a QR code symbol according to the seventhembodiment will be described.

FIG. 31 is a flow chart of a method for reading a QR code symbolaccording to the seventh embodiment. With reference to the flow chartand the foregoing FIG. 30, a method for reading a QR code symbolaccording to the seventh embodiment will be described.

First, an enhanced QR code symbol is read (S402). A procedure forreading the enhanced QR code symbol is the same as a procedure in thefirst embodiment. The description thereof will therefore be omitted.

Next, the value of a mask pattern reference MPR is read (S404). The maskpattern reference MPR is information included in format information FI,as mentioned above. In the QR code symbol 1, the format information FIis not masked by a standard mask pattern. This makes it possible toappropriately read format information FI in a procedure prescribed inJIS. The mask pattern reference MPR included in format information FIcan be identified.

Next, the standard mask pattern of the QR code symbol is removed (S406).The standard mask pattern applied to the QR code symbol 1 can beidentified by the mask pattern reference MPR. Using the identifiedstandard mask pattern, the standard mask pattern applied to the QR codesymbol 1 is removed.

Next, a plurality of RS blocks (in this example, replaced RS blocks) areexpanded from the QR code symbol whose standard mask pattern has beenremoved. The mask pattern reference MPR locates the positions ofconceal-information words in the replaced RS block (S408). In thisexample, the beginning position of the conceal-information words is aposition which is of the word corresponding to the value of the maskpattern reference MPR from the initial word of the replaced RS block.

FIG. 30 is referred herein again. For example, if the value of the maskpattern reference MPR is “6”, the beginning position of theconceal-information words is the position which is of the 6th word(six-word offset) from the initial word of the replaced RS block, asshown in FIG. 30.

Next, the conceal-information words are extracted from the identifiedpositions of the conceal-information words (S410). The replaced RS blockis corrected using a Reed-Solomon code (S412). By correcting using theReed-Solomon code, the replaced RS block is converted into an unreplacedRS block. It is possible to extract the original data from theunreplaced RS block.

Next, the original data and the conceal-information words which havebeen obtained are output (S414). The output may be displayed by thedisplay device 13, and may be printed by the printing device 14.

As mentioned above, the positions of the conceal-information words aredefined based on the mask pattern reference MPR. Also, the positions ofthe conceal-information words may be defined using the versioninformation of a QR code symbol. The versions of the QR codes range fromversion 1 to version 40 in JIS. Accordingly, based on the combination of8 types of the mask pattern reference MPRs and 40 types of the versions,the positions of the conceal-information words can be determined in adifferent manner of 320 types in total.

In addition to the foregoing combination, the information of the errorcorrection level of QR code symbol may be combined. In JIS, there arefour error correction levels: “level L”, “level M”, “level Q”, and“level H”. Accordingly, based on the additional combination with thesefour types, the positions of the conceal-information words can bedetermined in a different manner of 1280 types in total.

In this example, conceal-information words are replaced continuouslyfrom the identified position. But, conceal-information words may bereplaced separately as in the foregoing FIG. 18.

===Eighth Embodiment===

FIG. 32 is a diagram illustrating how to replace a part of a RS block ina procedure according to the eighth embodiment. In the eighthembodiment, as in the foregoing second embodiment, a part of anunreplaced RS block is replaced with header data codewords andconceal-information words, to generate a replaced RS block. In thiscase, replacement with the conceal-information words is performed at thepositions indicated by the header data codewords.

In the eighth embodiment, identifying replacement positions by the valueof the mask pattern reference MPR is the same as the seventh embodiment.A method for generating a QR code symbol according to the eighthembodiment will be described below with reference to a flow chart, whichis partly different from the flow chart used in the seventh embodiment.

Processes from step S302 to step S308 are the same as in the seventhembodiment. The description thereof will therefore be omitted. In theeighth embodiment, the difference from the seventh embodiment is aprocess in step S310. In the eighth embodiment, replacement with theheader data codewords is performed from the replacement start position,which is of the word corresponding to the value of the mask patternreference MPR from the initial word of the unreplaced RS block. At theposition identified by the header data codewords, a part of unreplacedRS block is replaced with the conceal-information words.

FIG. 32 shows a case in which the value of the mask pattern referenceMPR is “2” and in which the unreplaced RS block is replaced with theheader data codewords at the position which is of the 2nd word (two-wordoffset) from the initial word of the unreplaced RS block. As thereplacement position with the conceal-information words, the header datacodewords indicates a position which is of the eighth word (eight-wordoffset) from the initial word of the unreplaced RS block. Accordingly,the unreplaced RS block replaced with the conceal-information words fromthe position which is of the eighth word (eight-word offset) from theinitial word of the unreplaced RS block.

Below, processes from step S312 to step S322 are the same as in theseventh embodiment and the description thereof is omitted.

It is preferable that the replacement positions with the header datacodewords do not overlap the replacement positions with theconceal-information words. This is because, if these positions overlap,it is impossible to precisely recover at least either one of the headerdata codewords and the conceal-information words.

Next, modifying a part of the flow chart of the seventh embodiment, amethod for reading a QR code symbol according to the eighth embodimentwill be described.

Processes from step S402 to step S406 are the same as in the seventhembodiment. The description thereof will therefore be omitted. In theeighth embodiment, the difference from the seventh embodiment isprocesses in step S408 and step S410. In step S408 of the eighthembodiment, the positions of the header data codewords are located basedon the value of the mask pattern reference MPR, and the header datacodewords are extracted. In step S410, the positions of theconceal-information words are located using the header data codewords,and the conceal-information words are extracted.

Processes from step S412 to step S414 are the same as in the seventhembodiment and the description thereof is omitted.

Accordingly, the mask pattern reference MPR, which identifies thestandard mask pattern applied to the QR code symbol, is used to locate aposition of the RS block which is replaced with header data codewords.Since there are 8 types of the standard mask patterns, the value of themask pattern reference MPR can have 8 types of numbers. Depending on theapplied standard mask pattern, it is therefore possible to change thereplacement positions of the header data codewords. This makes itdifficult for a third party to locate the positions of the header datacodewords, and therefore it can be further difficult to extractconceal-information words.

Using a procedure according to the eighth embodiment, the QR code symbolin which the header data codewords are placed at the optimal positionscan be found at a time of evaluating in step S320 all QR code symbolswhich are each generated based on a different value of the mask patternreference MPR from 0 to 7. Until the evaluation of step S320, a QR codesymbol which is to be employed cannot be decided among the QR codesymbol in which replacement positions with the header data codewords aredifferent. As mentioned above, the replacement positions with the headerdata codewords cannot be determined in advance. This makes it difficultto locate the positions of the header data codewords. Since locating thepositions of the header data codewords is difficult, it is furtherdifficult to locate the positions of the conceal-information words. Thisallows extraction of the conceal-information words to be difficult.

===Ninth Embodiment===

In the ninth embodiment, when an unreplaced RS block is replaced withconceal-information words, positions at which replacement is performedare identified based on correction codewords (a RS code). A method forgenerating a QR code symbol according to the ninth embodiment will bedescribed below with reference to a flow chart, which is partlydifferent from the flow chart used in the first embodiment.

Processes from step S102 to step S106 are the same as in the firstembodiment. The description thereof will therefore be omitted. In theninth embodiment, the difference from the first embodiment is that,between step S106 and step S108, the replacement positions of theconceal-information words is identified based on the correctioncodewords.

FIG. 33 is a first diagram illustrating how to replace a part of a RSblock in a procedure according to the ninth embodiment. FIG. 33 shows anunreplaced RS block. In the ninth embodiment, the replacement positionswith the conceal-information words are identified based on multiple bitsof a specific byte in the correction codewords. Specifically speaking,in this example, the third byte of the correction codewords isextracted, and low-order 4 bits are extracted from the byte. Thereplacement positions with the conceal-information words are indicatedby the values of these low-order 4 bits. FIG. 33 shows the digits “0010”as information of the low-order 4 bits. The digits “0010” mean “2” indecimal form. But, in this example, since “0” means a first position,“0010” means the third position from the initial word. Next, replacementwith conceal-information words is performed based on the replacementpositions (S108).

FIG. 34 is a second diagram illustrating how to replace a part of a RSblock in a procedure according to the ninth embodiment. FIG. 34 showsreplacement with the conceal-information words from the position whichis of the third byte (the position of the third word) from the initialword of the unreplaced RS block. As mentioned above, the replacementpositions of the conceal-information words are identified based on thecorrection codewords, and replacement with the conceal-information wordsis performed.

When replacement with the conceal-information words is performed asmentioned above (S108), a QR code is generated based on the replaced RSblock (S110). Then, masking in the standard mask pattern is performed.Masking in the standard mask pattern is in conformance with JIS.

The correction codewords are obtained based on the data codewords.Accordingly, if the data codewords are different, the correctioncodewords are also different. That is, when the replacement positionsare identified based on the correction codewords, if the data codewordsare different, the replacement positions are also different. This makesit difficult for a third party to locate the positions of theconceal-information words, and therefore it can be further difficult toextract the conceal-information words.

Next, modifying a part of the flow chart of the first embodiment, amethod for reading a QR code symbol according to the ninth embodimentwill be described.

Processes from step S202 to step S204 are the same as in the firstembodiment. The description thereof will therefore be omitted. In theninth embodiment, the difference from the first embodiment is a processin step S206. In the ninth embodiment, the replacement positions withthe conceal-information words are identified based on a bit of aspecific byte in the correction codewords. In this example, the thirdbyte of the correction codeword is extracted as mentioned above, andlow-order 4 bits are extracted from the byte. the replacement positionswith the conceal-information words are identified based on the values ofthese low-order 4 bits. As shown in FIG. 34, this makes it possible toappropriately identify the positions of the conceal-information wordsand to extract the conceal-information words.

When the replaced RS block is subsequently corrected using thecorrection codewords, the data codewords can be appropriately extracted.

Outputting the result of the extracted data is the same as in the firstembodiment (S108) and the description thereof is omitted.

When a part of the unreplaced RS block is replaced withconceal-information words, there is a possibility that the bytes of thecorrection codewords for identifying the replacement position arereplaced. In this case, the replaced RS block may be corrected inadvance using the correction codewords. Since this makes it possible toacquire the unreplaced RS block, it is possible to appropriately extractthe bytes of the correction codewords for identifying the replacementposition.

In the foregoing description, the third byte of the correction codewordsis used. No matter of course, another byte of the correction codewordsmay be used. Using low-order bits makes it possible to indicate 16patterns of the positions, and, by using 5 or more bits, it is possibleto increase the number of the positions patterns which can be indicated.

In the description above, the correction codewords are used in order toidentify the replacement positions with the conceal-information words.However, a concept of the second embodiment, header data codewords, maybe introduced, and the position of the header data codeword may beidentified by the foregoing correction codewords. The error correctioncodewords are obtained based on the data codewords. Accordingly, if thedata codewords are different, the error correction codewords are alsodifferent. That is, when the replacement positions are identified basedon the error correction codewords, if data codewords are different, thereplacement positions are also different. This makes it difficult for athird party to locate the positions of the header data codewords. Sincethe header data codewords locate the positions of conceal-informationwords, it can be therefore further difficult to extract theconceal-information words.

===Application Example===

The foregoing QR code symbol can be used, for example, by printing ontickets of an event or a concert to be sold on reservation salesservices. In this case, the “information to be displayed” can be “nameof event”, “seat information”, “reservation number”, and “URL”. On theother hand, the conceal information can be “information used at the timeof booking”. As the “information used at the time of booking”, thefollowing information can be employed: ID information such as “Gender”,“Age”, “Name”, and “License card”; or “Passphrase”.

Under the foregoing conditions, counterfeiting in which a new QR code isgenerated by using only information to be displayed will be assumed. Inthis case, the QR code symbol does not include conceal information. Itis therefore possible to determine that the QR code symbol is a forgedone.

In a case of copying and using a QR code symbol which is generatedaccording to any one of embodiments from the first embodiment to thesixth embodiment, the enhanced decoder 20 reads conceal information.Then, the ticket holder's identify is verified based on ID informationsuch as “Gender”, “Age”, and “License card” or “Passphrase”, which iscontained in the conceal information. This makes it possible to preventunauthorized use and spoofing.

REFERENCE SIGNS LIST

10 enhanced encoder,

11 control section, 11 a operation section, 11 b storage section,

13 display device, 14 printing device, 15 input device,

20 enhanced decoder,

21 control section, 21 a operation section, 21 b storage section,

22 imaging device, 23 display device, 24 printing device, 25 inputdevice

The invention claimed is:
 1. A method for generating a two-dimensionalbarcode comprising: obtaining a data block including a first datacodeword and an error correction codeword, the first data codewordhaving first information, the error correction codeword being capable ofdetecting and correcting an error of the first data codeword; obtaininga replaced data block in which a part of the data block is replaced witha second data codeword, the second data codeword having secondinformation; and generating a two-dimensional barcode based on thereplaced data block, wherein obtaining the replaced data block includes:identifying a replacement position in the data block based on the errorcorrection codeword; and replacing a part of the data block with thesecond data codeword at the replacement position.
 2. A device forgenerating a two-dimensional barcode, wherein the device generatesaccording to the method of claim 1, a two-dimensional barcode based on areplaced data block, the replaced data block in which a part of a datablock is replaced with a second data codeword, the data block includinga first data codeword and an error correction codeword, the first datacodeword having first information, the error correction codeword beingcapable of detecting and correcting an error of the first data codeword,the second data codeword having second information.
 3. A non-transitorycomputer-readable storage medium storing a program causing a computer toperform the method as recited in claim
 1. 4. A method for generating atwo-dimensional barcode comprising; obtaining a data block including afirst data codeword and an error correction codeword, the first datacodeword having first information, the error correction codeword beingcapable of detecting and correcting an error of the first data codeword;obtaining a replaced data block in which a part of the data block isreplaced with a second data codeword, the second data codeword havingsecond information; and generating a two-dimensional barcode based onthe replaced data block, wherein the replaced data block includes aheader data codeword, and the header data codeword contains placementinformation of the second data codeword in the replaced data block, andwherein obtaining the replaced data block includes: identifying areplacement position in the data block based on the error correctioncodeword; replacing a part of the data block with the header datacodeword at the identified replacement position; and replacing a part ofthe data block with the second data codeword at a position that isspecified by the header data codeword.
 5. A non-transitorycomputer-readable storage medium storing a program causing a computer toperform the method as recited in claim 4.